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 livewireTestsPath($path = '')
{
return base_path('tests/Feature/Livewire'.($path ? '/'.$path : ''));
}
}
<?php public function relativeClassPath() : string
{
return str($this->classPath())->replaceFirst(base_path().DIRECTORY_SEPARATOR, '');
}
public function classFile()
<?php {
$stubName = $inline ? 'livewire.inline.stub' : 'livewire.stub';
if (File::exists($stubPath = base_path($this->stubDirectory.$stubName))) {
$template = file_get_contents($stubPath);
} else {
$template = file_get_contents(__DIR__.DIRECTORY_SEPARATOR.$stubName);
<?php public function relativeViewPath() : string
{
return str($this->viewPath())->replaceFirst(base_path().'/', '');
}
public function viewFile()
<?php public function viewContents()
{
if( ! File::exists($stubPath = base_path($this->stubDirectory.'livewire.view.stub'))) {
$stubPath = __DIR__.DIRECTORY_SEPARATOR.'livewire.view.stub';
}
<?php public function relativeTestPath() : string
{
return str($this->testPath())->replaceFirst(base_path().'/', '');
}
public function testContents($testType = 'phpunit')
<?php {
$stubName = $testType === 'pest' ? 'livewire.pest.stub' : 'livewire.test.stub';
if(File::exists($stubPath = base_path($this->stubDirectory.$stubName))) {
$template = file_get_contents($stubPath);
} else {
$template = file_get_contents(__DIR__.DIRECTORY_SEPARATOR.$stubName);
<?php public static function generateTestPathFromNamespace($namespace)
{
return base_path(str($namespace)
->replace('\\', '/', $namespace)
->replaceFirst('T', 't'));
}
}
<?php $stubDirectory = rtrim('stubs' . DIRECTORY_SEPARATOR . $stubSubDirectory, DIRECTORY_SEPARATOR) . '/';
}
if (File::exists($stubPath = base_path($stubDirectory . $stubName))) {
return $stubPath;
}
<?php protected function relativeLayoutPath($layoutPath)
{
return (string) str($layoutPath)->replaceFirst(base_path() . '/', '');
}
}
<?php public function handle()
{
if (! is_dir($stubsPath = base_path('stubs'))) {
(new Filesystem)->makeDirectory($stubsPath);
}
<?php {
return Storage::build([
'driver' => 'local',
'root' => base_path(),
]);
}
<?php protected function stubsPath($path = '')
{
return base_path('stubs'.($path ? '/'.$path : ''));
}
}
<?php {
$config = __DIR__.'/../config/livewire.php';
$this->publishes([$config => base_path('config/livewire.php')], ['livewire', 'livewire:config']);
$this->mergeConfigFrom($config, 'livewire');
}
<?php protected function livewireTestsPath($path = '')
{
return base_path('tests/Feature/Livewire'.($path ? '/'.$path : ''));
}
}