update fixed report cache..
This commit is contained in:
parent
70e374ac86
commit
33877c90d2
@ -39,6 +39,5 @@ class Version2116 extends Listener
|
|||||||
}
|
}
|
||||||
|
|
||||||
Artisan::call('migrate', ['--force' => true]);
|
Artisan::call('migrate', ['--force' => true]);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
57
app/Listeners/Update/V21/Version2117.php
Normal file
57
app/Listeners/Update/V21/Version2117.php
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Listeners\Update\V21;
|
||||||
|
|
||||||
|
use App\Abstracts\Listeners\Update as Listener;
|
||||||
|
use App\Events\Install\UpdateFinished as Event;
|
||||||
|
use App\Models\Common\Company;
|
||||||
|
use App\Models\Common\Report;
|
||||||
|
use App\Utilities\Reports as Utility;
|
||||||
|
use Illuminate\Support\Facades\Artisan;
|
||||||
|
|
||||||
|
class Version2117 extends Listener
|
||||||
|
{
|
||||||
|
const ALIAS = 'core';
|
||||||
|
|
||||||
|
const VERSION = '2.1.17';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the event.
|
||||||
|
*
|
||||||
|
* @param $event
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function handle(Event $event)
|
||||||
|
{
|
||||||
|
if ($this->skipThisUpdate($event)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->updateCompanies();
|
||||||
|
|
||||||
|
Artisan::call('migrate', ['--force' => true]);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function updateCompanies()
|
||||||
|
{
|
||||||
|
$company_id = company_id();
|
||||||
|
|
||||||
|
$companies = Company::cursor();
|
||||||
|
|
||||||
|
foreach ($companies as $company) {
|
||||||
|
$company->makeCurrent();
|
||||||
|
|
||||||
|
$this->cacheReports();
|
||||||
|
}
|
||||||
|
|
||||||
|
company($company_id)->makeCurrent();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function cacheReports()
|
||||||
|
{
|
||||||
|
Report::all()->each(function ($report) {
|
||||||
|
Cache::put('reports.totals.' . $report->id, Utility::getClassInstance($report)->getGrandTotal());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -33,6 +33,7 @@ class Event extends Provider
|
|||||||
'App\Listeners\Update\V21\Version2112',
|
'App\Listeners\Update\V21\Version2112',
|
||||||
'App\Listeners\Update\V21\Version2114',
|
'App\Listeners\Update\V21\Version2114',
|
||||||
'App\Listeners\Update\V21\Version2116',
|
'App\Listeners\Update\V21\Version2116',
|
||||||
|
'App\Listeners\Update\V21\Version2117',
|
||||||
],
|
],
|
||||||
'Illuminate\Auth\Events\Login' => [
|
'Illuminate\Auth\Events\Login' => [
|
||||||
'App\Listeners\Auth\Login',
|
'App\Listeners\Auth\Login',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user