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 protected function livewireClassesPath($path = '')
{
return app_path('Livewire'.($path ? '/'.$path : ''));
}
protected function livewireViewsPath($path = '')
<?php protected function livewireClassesPath($path = '')
{
return app_path('Livewire'.($path ? '/'.$path : ''));
}
protected function livewireViewsPath($path = '')
<?php {
$namespace = str(config('livewire.class_namespace'))->replaceFirst(app()->getNamespace(), '');
$livewireFolder = app_path($namespace->explode('\\')->implode(DIRECTORY_SEPARATOR));
return ! File::isDirectory($livewireFolder);
}
<?php $this->assertEquals($component, $parser->component());
$this->assertEquals($namespace, $parser->classNamespace());
$this->assertEquals($this->normalizeDirectories(app_path($classPath)), $this->normalizeDirectories($parser->classPath()));
$this->assertEquals($viewName, $parser->viewName());
$this->assertEquals($this->normalizeDirectories(resource_path('views/'.$viewPath)), $this->normalizeDirectories($parser->viewPath()));
}
<?php protected function livewireClassesPath($path = '')
{
return app_path('Livewire'.($path ? '/'.$path : ''));
}
protected function livewireViewsPath($path = '')
<?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,
};