Create constant CORE_PATH and rework project loaders

This commit is contained in:
2021-01-27 12:22:12 +03:00
parent 04e766af45
commit 23cb69919c
5 changed files with 10 additions and 8 deletions

View File

@@ -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));
}

View File

@@ -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 = [];

View File

@@ -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([

View File

@@ -1,9 +1,11 @@
<?php
require_once __DIR__.'/../../../vendor/autoload.php';
define('CORE_PATH', __DIR__.'/../../../..');
require_once CORE_PATH . '/vendor/autoload.php';
(new Laravel\Lumen\Bootstrap\LoadEnvironmentVariables(
dirname(__DIR__) . '/../../../'
CORE_PATH . '/'
))->bootstrap();
date_default_timezone_set(env('APP_TIMEZONE', 'UTC'));

View File

@@ -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('.', '..'));