The
config
function gets the value of a configuration variable. The configuration values may be accessed using "dot" syntax, which includes the name of the file and the option you wish to access. A default value may be specified and is returned if the configuration option does not exist:<?php $value = config('app.timezone');
$value = config('app.timezone', $default);
<?php public static function relativeNamespace(string $fullyQualifiedClassName)
{
$namespace = config('blueprint.namespace') . '\\';
$reference = ltrim($fullyQualifiedClassName, '\\');
if (Str::startsWith($reference, $namespace)) {
<?php public static function appPath()
{
return str_replace('\\', '/', config('blueprint.app_path'));
}
public static function useReturnTypeHints()
<?php public static function useReturnTypeHints()
{
return boolval(config('blueprint.use_return_types'));
}
public function parse($content, $strip_dashes = true)
<?php $blueprint->registerLexer(new \Blueprint\Lexers\SeederLexer());
$blueprint->registerLexer(new \Blueprint\Lexers\ControllerLexer(new \Blueprint\Lexers\StatementLexer()));
foreach (config('blueprint.generators') as $generator) {
$blueprint->registerGenerator(new $generator($app['files']));
}
<?php $body .= self::INDENT . $statement->output() . PHP_EOL;
if ($statement->type() === SendStatement::TYPE_NOTIFICATION_WITH_FACADE) {
$this->addImport($controller, 'Illuminate\\Support\\Facades\\Notification');
$this->addImport($controller, config('blueprint.namespace') . '\\Notification\\' . $statement->mail());
} elseif ($statement->type() === SendStatement::TYPE_MAIL) {
$this->addImport($controller, 'Illuminate\\Support\\Facades\\Mail');
$this->addImport($controller, config('blueprint.namespace') . '\\Mail\\' . $statement->mail());
<?php $this->addImport($controller, config('blueprint.namespace') . '\\Notification\\' . $statement->mail());
} elseif ($statement->type() === SendStatement::TYPE_MAIL) {
$this->addImport($controller, 'Illuminate\\Support\\Facades\\Mail');
$this->addImport($controller, config('blueprint.namespace') . '\\Mail\\' . $statement->mail());
}
} elseif ($statement instanceof ValidateStatement) {
$using_validation = true;
<?php $using_validation = true;
$class_name = $controller->name() . Str::studly($name) . 'Request';
$fqcn = config('blueprint.namespace') . '\\Http\\Requests\\' . ($controller->namespace() ? $controller->namespace() . '\\' : '') . $class_name;
$method = str_replace('\Illuminate\Http\Request $request', '\\' . $fqcn . ' $request', $method);
$method = str_replace('(Request $request', '(' . $class_name . ' $request', $method);
<?php $this->addImport($controller, $fqcn);
} elseif ($statement instanceof DispatchStatement) {
$body .= self::INDENT . $statement->output() . PHP_EOL;
$this->addImport($controller, config('blueprint.namespace') . '\\Jobs\\' . $statement->job());
} elseif ($statement instanceof FireStatement) {
$body .= self::INDENT . $statement->output() . PHP_EOL;
if (!$statement->isNamedEvent()) {
<?php } elseif ($statement instanceof FireStatement) {
$body .= self::INDENT . $statement->output() . PHP_EOL;
if (!$statement->isNamedEvent()) {
$this->addImport($controller, config('blueprint.namespace') . '\\Events\\' . $statement->event());
}
} elseif ($statement instanceof RenderStatement) {
$body .= self::INDENT . $statement->output() . PHP_EOL;
<?php } elseif ($statement instanceof RenderStatement) {
$body .= self::INDENT . $statement->output() . PHP_EOL;
} elseif ($statement instanceof ResourceStatement) {
$fqcn = config('blueprint.namespace') . '\\Http\\Resources\\' . ($controller->namespace() ? $controller->namespace() . '\\' : '') . $statement->name();
$method = str_replace('* @return \\Illuminate\\Http\\Response', '* @return \\' . $fqcn, $method);
$this->addImport($controller, $fqcn);
$body .= self::INDENT . $statement->output() . PHP_EOL;
<?php return $model->fullyQualifiedClassName();
}
return config('blueprint.namespace') . '\\' . ($sub_namespace ? $sub_namespace . '\\' : '') . $model_name;
}
}
<?php private function fillableColumns(array $columns): array
{
if (config('blueprint.fake_nullables')) {
return $columns;
}
<?php $on = Str::plural($column);
$foreign = Str::singular($column) . '_' . $references;
if (config('blueprint.use_constraints')) {
$this->hasForeignKeyConstraints = true;
$definition .= $this->buildForeignKey($foreign, $on, 'id') . ';' . PHP_EOL;
} else {
<?php $on = Str::lower(Str::plural($parentTable));
$foreign = Str::lower(Str::singular($parentTable)) . '_' . $references;
if (config('blueprint.use_constraints')) {
$this->hasForeignKeyConstraints = true;
$definition .= $this->buildForeignKey($foreign, $on, 'id') . ';' . PHP_EOL;
} else {
<?php $on_delete_suffix = $on_update_suffix = null;
$on_delete_clause = collect($modifiers)->firstWhere('onDelete');
if (config('blueprint.use_constraints') || $on_delete_clause) {
$on_delete_clause = $on_delete_clause ? $on_delete_clause['onDelete'] : config('blueprint.on_delete', 'cascade');
$on_delete_suffix = self::ON_DELETE_CLAUSES[$on_delete_clause];
}