The
app_path
function returns the fully qualified path to your application's app
directory. You may also use the app_path
function to generate a fully qualified path to a file relative to the application directory:<?php $path = app_path();
$path = app_path('Http/Controllers/Controller.php');
<?php return $model;
}
return is_dir(app_path('Models'))
? $rootNamespace.'Models\\'.$model
: $rootNamespace.$model;
}
<?php protected function possibleModels()
{
$modelPath = is_dir(app_path('Models')) ? app_path('Models') : app_path();
return collect(Finder::create()->files()->depth(0)->in($modelPath))
->map(fn ($file) => $file->getBasename('.php'))
<?php protected function possibleEvents()
{
$eventPath = app_path('Events');
if (! is_dir($eventPath)) {
return [];
<?php return $modelName;
}
if (is_dir(app_path('Models/'))) {
return $this->rootNamespace().'Models\Model';
}
<?php return $namespace.str_replace(
['/', '.php'],
['\\', ''],
Str::after($model->getRealPath(), realpath(app_path()).DIRECTORY_SEPARATOR)
);
})->when(! empty($except), function ($models) use ($except) {
return $models->reject(function ($model) use ($except) {
<?php })->all();
}
return app_path('Models');
}
<?php return $model;
}
return is_dir(app_path('Models'))
? $rootNamespace.'Models\\'.$model
: $rootNamespace.$model;
}
<?php protected function getDefaultNamespace($rootNamespace)
{
return match (true) {
is_dir(app_path('Enums')) => $rootNamespace.'\\Enums',
is_dir(app_path('Enumerations')) => $rootNamespace.'\\Enumerations',
default => $rootNamespace,
};
<?php {
return match (true) {
is_dir(app_path('Enums')) => $rootNamespace.'\\Enums',
is_dir(app_path('Enumerations')) => $rootNamespace.'\\Enumerations',
default => $rootNamespace,
};
}
<?php protected function getDefaultNamespace($rootNamespace)
{
return match (true) {
is_dir(app_path('Contracts')) => $rootNamespace.'\\Contracts',
is_dir(app_path('Interfaces')) => $rootNamespace.'\\Interfaces',
default => $rootNamespace,
};
<?php {
return match (true) {
is_dir(app_path('Contracts')) => $rootNamespace.'\\Contracts',
is_dir(app_path('Interfaces')) => $rootNamespace.'\\Interfaces',
default => $rootNamespace,
};
}
<?php return $namespace.str_replace(
['/', '.php'],
['\\', ''],
Str::after($file->getRealPath(), realpath(app_path()).DIRECTORY_SEPARATOR)
);
}
<?php protected function getDefaultNamespace($rootNamespace)
{
return is_dir(app_path('Models')) ? $rootNamespace.'\\Models' : $rootNamespace;
}
<?php protected function getDefaultNamespace($rootNamespace)
{
return is_dir(app_path('Models')) ? $rootNamespace.'\\Models\\Scopes' : $rootNamespace.'\Scopes';
}
<?php protected function getDefaultNamespace($rootNamespace)
{
return match (true) {
is_dir(app_path('Concerns')) => $rootNamespace.'\\Concerns',
is_dir(app_path('Traits')) => $rootNamespace.'\\Traits',
default => $rootNamespace,
};