refactored report and update abstracts
This commit is contained in:
@ -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;
|
||||
|
39
app/Abstracts/Listeners/Update.php
Normal file
39
app/Abstracts/Listeners/Update.php
Normal 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);
|
||||
}
|
||||
}
|
@ -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;
|
Reference in New Issue
Block a user