From 23cb69919cc86b0e453fc62efe6e2e71c9dc537d Mon Sep 17 00:00:00 2001 From: Timoffei Bubigo Date: Wed, 27 Jan 2021 12:22:12 +0300 Subject: [PATCH] Create constant CORE_PATH and rework project loaders --- app/Console/Commands/HRCCommand.php | 6 +++--- app/Console/Kernel.php | 2 +- app/Providers/AppServiceProvider.php | 2 +- bootstrap/app.php | 6 ++++-- database/seeders/DatabaseSeeder.php | 2 +- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/app/Console/Commands/HRCCommand.php b/app/Console/Commands/HRCCommand.php index db32b3d..fc9a953 100644 --- a/app/Console/Commands/HRCCommand.php +++ b/app/Console/Commands/HRCCommand.php @@ -30,7 +30,7 @@ class HRCCommand extends Command private function prepareInput() { - $source_file = base_path() . '/../temp/' . $this->argument('source'); + $source_file = CORE_PATH . '/temp/' . $this->argument('source'); $data = parse_ini_file($source_file); if(isset($data['raw_result'])) { @@ -42,7 +42,7 @@ class HRCCommand extends Command private function prepareOutput() { - $source_file = base_path() . '/../temp/' . $this->argument('source'); + $source_file = CORE_PATH . '/temp/' . $this->argument('source'); $data = parse_ini_file($source_file); if(isset($data['raw_result'])) { @@ -54,7 +54,7 @@ class HRCCommand extends Command public function save($result) { - $result_file = base_path() . '/../temp/' . $this->argument('result'); + $result_file = CORE_PATH . '/temp/' . $this->argument('result'); file_put_contents($result_file, json_encode($result)); } diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 8d601b3..d45bf3e 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -22,7 +22,7 @@ class Kernel extends ConsoleKernel public function getCommands() { - $commands_path = base_path() . '/../../../commands'; + $commands_path = CORE_PATH . '/commands'; $files = array_diff(scandir($commands_path), array('.', '..')); $classes = []; diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 5c4daa2..8256d75 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -19,7 +19,7 @@ class AppServiceProvider extends ServiceProvider public function boot() { - $migrations_path = base_path() . '/../database/migrations'; + $migrations_path = CORE_PATH . '/database/migrations'; $default_path = database_path('migrations'); $this->loadMigrationsFrom([ diff --git a/bootstrap/app.php b/bootstrap/app.php index 104c2db..7a8b0dd 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -1,9 +1,11 @@ bootstrap(); date_default_timezone_set(env('APP_TIMEZONE', 'UTC')); diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index d437312..2a43ca0 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -14,7 +14,7 @@ class DatabaseSeeder extends Seeder */ public function run() { - $seeders_path = base_path() . '/../../../database/seeders'; + $seeders_path = CORE_PATH . '/database/seeders'; if(file_exists($seeders_path)) { $files = array_diff(scandir($seeders_path), array('.', '..'));