diff --git a/src/Illuminate/Database/DatabaseServiceProvider.php b/src/Illuminate/Database/DatabaseServiceProvider.php index ea78a59d178d..a8ee7b030b78 100755 --- a/src/Illuminate/Database/DatabaseServiceProvider.php +++ b/src/Illuminate/Database/DatabaseServiceProvider.php @@ -80,7 +80,7 @@ protected function registerEloquentFactory() $this->app->singleton(EloquentFactory::class, function ($app) { return EloquentFactory::construct( - $app->make(FakerGenerator::class), database_path('factories') + $app->make(FakerGenerator::class), $this->app->databasePath('factories') ); }); } diff --git a/src/Illuminate/Foundation/Application.php b/src/Illuminate/Foundation/Application.php index 08843b1e7c13..4f514af5f51a 100755 --- a/src/Illuminate/Foundation/Application.php +++ b/src/Illuminate/Foundation/Application.php @@ -294,51 +294,56 @@ protected function bindPathsInContainer() /** * Get the path to the application "app" directory. * + * @param string $path Optionally, a path to append to the app path * @return string */ - public function path() + public function path($path = '') { - return $this->basePath.DIRECTORY_SEPARATOR.'app'; + return $this->basePath.DIRECTORY_SEPARATOR.'app'.($path ? DIRECTORY_SEPARATOR.$path : $path); } /** * Get the base path of the Laravel installation. * + * @param string $path Optionally, a path to append to the base path * @return string */ - public function basePath() + public function basePath($path = '') { - return $this->basePath; + return $this->basePath.($path ? DIRECTORY_SEPARATOR.$path : $path); } /** * Get the path to the bootstrap directory. * + * @param string $path Optionally, a path to append to the bootstrap path * @return string */ - public function bootstrapPath() + public function bootstrapPath($path = '') { - return $this->basePath.DIRECTORY_SEPARATOR.'bootstrap'; + return $this->basePath.DIRECTORY_SEPARATOR.'bootstrap'.($path ? DIRECTORY_SEPARATOR.$path : $path); } /** * Get the path to the application configuration files. * + * @param string $path Optionally, a path to append to the config path * @return string */ - public function configPath() + public function configPath($path = '') { - return $this->basePath.DIRECTORY_SEPARATOR.'config'; + return $this->basePath.DIRECTORY_SEPARATOR.'config'.($path ? DIRECTORY_SEPARATOR.$path : $path); } /** * Get the path to the database directory. * + * @param string $path Optionally, a path to append to the database path * @return string */ - public function databasePath() + public function databasePath($path = '') { - return $this->databasePath ?: $this->basePath.DIRECTORY_SEPARATOR.'database'; + return ($this->databasePath ?: $this->basePath.DIRECTORY_SEPARATOR.'database').($path ? DIRECTORY_SEPARATOR.$path : $path); } /** diff --git a/src/Illuminate/Foundation/helpers.php b/src/Illuminate/Foundation/helpers.php index 84ebf2d781e6..6b6ebf5b79b0 100644 --- a/src/Illuminate/Foundation/helpers.php +++ b/src/Illuminate/Foundation/helpers.php @@ -346,7 +346,7 @@ function csrf_token() */ function database_path($path = '') { - return app()->databasePath().($path ? DIRECTORY_SEPARATOR.$path : $path); + return app()->databasePath($path); } } diff --git a/src/Illuminate/Notifications/NotificationServiceProvider.php b/src/Illuminate/Notifications/NotificationServiceProvider.php index ba1fb2c3ad4c..e8909f4551e0 100644 --- a/src/Illuminate/Notifications/NotificationServiceProvider.php +++ b/src/Illuminate/Notifications/NotificationServiceProvider.php @@ -19,7 +19,7 @@ public function boot() if ($this->app->runningInConsole()) { $this->publishes([ - __DIR__.'/resources/views' => resource_path('views/vendor/notifications'), + __DIR__.'/resources/views' => $this->app->resourcePath('views/vendor/notifications'), ], 'laravel-notifications'); } } diff --git a/src/Illuminate/Pagination/PaginationServiceProvider.php b/src/Illuminate/Pagination/PaginationServiceProvider.php index 3751507eb2a0..d5ca6daec800 100755 --- a/src/Illuminate/Pagination/PaginationServiceProvider.php +++ b/src/Illuminate/Pagination/PaginationServiceProvider.php @@ -17,7 +17,7 @@ public function boot() if ($this->app->runningInConsole()) { $this->publishes([ - __DIR__.'/resources/views' => resource_path('views/vendor/pagination'), + __DIR__.'/resources/views' => $this->app->resourcePath('views/vendor/pagination'), ], 'laravel-pagination'); } }