refactored report and update abstracts

This commit is contained in:
denisdulici
2019-11-23 21:47:20 +03:00
parent eef7eaa12f
commit 51a7fa86fc
37 changed files with 54 additions and 48 deletions

View File

@ -1,6 +1,6 @@
<?php
namespace App\Abstracts\Reports;
namespace App\Abstracts\Listeners;
use App\Events\Common\ReportFilterApplying;
use App\Events\Common\ReportFilterShowing;
@ -12,7 +12,7 @@ use App\Models\Setting\Category;
use App\Traits\Contacts;
use Date;
abstract class Listener
abstract class Report
{
use Contacts;

View File

@ -0,0 +1,39 @@
<?php
namespace App\Abstracts\Listeners;
abstract class Update
{
const ALIAS = '';
const VERSION = '';
/**
* Check the fired update based on alias and version.
*
* @param $event
* @return boolean
*/
public function skipThisUpdate($event)
{
// Apply only to the specified alias
if ($event->alias != static::ALIAS) {
return true;
}
// Do not apply to the same or newer versions
if (version_compare($event->old, static::VERSION, '>=')) {
return true;
}
return false;
}
/**
* @deprecated since 2.0
*/
public function check($event)
{
return !$this->skipThisUpdate($event);
}
}

View File

@ -1,6 +1,6 @@
<?php
namespace App\Abstracts\Reports;
namespace App\Abstracts;
use App\Exports\Common\Reports as Export;
use App\Models\Common\Report as Model;