The
base_path
function returns the fully qualified path to your application's root directory. You may also use the base_path
function to generate a fully qualified path to a given file relative to the project root directory:<?php $path = base_path();
$path = base_path('vendor/bin');
<?php protected function execute($container)
{
return Process::fromShellCommandline(
$this->buildCommand(), base_path(), null, null, null
)->run();
}
<?php public function __invoke($string)
{
if (function_exists('app') && app()->has('path.base')) {
$string = str_replace(base_path().'/', '', $string);
}
return $string;
<?php {
if (! empty($path = $this->option('path'))) {
return collect($path)->map(function ($path) {
return base_path($path);
})->all();
}
<?php $this->components->info('Installing and building Node dependencies.');
if (file_exists(base_path('pnpm-lock.yaml'))) {
$commands = [
'pnpm add --save-dev laravel-echo pusher-js',
'pnpm run build',
<?php 'pnpm add --save-dev laravel-echo pusher-js',
'pnpm run build',
];
} elseif (file_exists(base_path('yarn.lock'))) {
$commands = [
'yarn add --dev laravel-echo pusher-js',
'yarn run build',
<?php 'yarn add --dev laravel-echo pusher-js',
'yarn run build',
];
} elseif (file_exists(base_path('bun.lockb'))) {
$commands = [
'bun add --dev laravel-echo pusher-js',
'bun run build',
<?php }
$command = Process::command(implode(' && ', $commands))
->path(base_path());
if (! windows_os()) {
$command->tty(true);
<?php {
$reflection = new ReflectionFunction($rawListener);
$path = str_replace([base_path(), DIRECTORY_SEPARATOR], ['', '/'], $reflection->getFileName() ?: '');
return 'Closure at: '.$path.':'.$reflection->getStartLine();
}
<?php return false;
}
return str_starts_with($path, base_path('vendor'));
}
<?php $actionClass = explode('@', $action)[0];
if (class_exists($actionClass) && str_starts_with((new ReflectionClass($actionClass))->getFilename(), base_path('vendor'))) {
$actionCollection = collect(explode('\\', $action));
return $name.$actionCollection->take(2)->implode('\\').' '.$actionCollection->last();
<?php public function handle()
{
$environmentFile = $this->option('env')
? base_path('.env').'.'.$this->option('env')
: base_path('.env');
$hasEnvironment = file_exists($environmentFile);
<?php {
$environmentFile = $this->option('env')
? base_path('.env').'.'.$this->option('env')
: base_path('.env');
$hasEnvironment = file_exists($environmentFile);
<?php protected function serverCommand()
{
$server = file_exists(base_path('server.php'))
? base_path('server.php')
: __DIR__.'/../resources/server.php';
<?php protected function serverCommand()
{
$server = file_exists(base_path('server.php'))
? base_path('server.php')
: __DIR__.'/../resources/server.php';
return [
<?php {
$name = Str::replaceFirst($this->rootNamespace(), '', $name);
return base_path('tests').str_replace('\\', '/', $name).'.php';
}