close #782 Enhancement: Schedule Time configuration change

This commit is contained in:
cuneytsenturk
2019-03-07 16:41:14 +03:00
parent 8b0a1a5034
commit 46decc1250
7 changed files with 56 additions and 10 deletions

View File

@@ -5,7 +5,7 @@ namespace App\Listeners\Updates\V11;
use App\Events\UpdateFinished;
use App\Listeners\Updates\Listener;
use App\Models\Common\Company;
use DotenvEditor;
use App\Utilities\Installer;
class Version112 extends Listener
{
@@ -34,11 +34,6 @@ class Version112 extends Listener
}
// Set default locale
DotenvEditor::setKeys([
[
'key' => 'APP_LOCALE',
'value' => $locale,
],
])->save();
Installer::updateEnv(['APP_LOCALE' => $locale]);
}
}

View File

@@ -0,0 +1,43 @@
<?php
namespace App\Listeners\Updates\V13;
use App\Events\UpdateFinished;
use App\Listeners\Updates\Listener;
use App\Models\Common\Company;
use App\Utilities\Installer;
use Artisan;
class Version1313 extends Listener
{
const ALIAS = 'core';
const VERSION = '1.3.13';
/**
* Handle the event.
*
* @param $event
* @return void
*/
public function handle(UpdateFinished $event)
{
// Check if should listen
if (!$this->check($event)) {
return;
}
$schedule_time = '09:00';
// Get default locale if only 1 company
if (Company::all()->count() == 1) {
$schedule_time = setting('general.schedule_time', '09:00');
}
// Set default locale
Installer::updateEnv(['APP_SCHEDULE_TIME' => '"' . $schedule_time . '"']);
// Update database
Artisan::call('migrate', ['--force' => true]);
}
}