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

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

View File

@ -2,7 +2,7 @@
namespace App\Listeners\Common;
use App\Abstracts\Reports\Listener;
use App\Abstracts\Listeners\Report as Listener;
use App\Events\Common\ReportFilterApplying;
use App\Events\Common\ReportFilterShowing;
use App\Events\Common\ReportGroupApplying;

View File

@ -2,7 +2,7 @@
namespace App\Listeners\Common;
use App\Abstracts\Reports\Listener;
use App\Abstracts\Listeners\Report as Listener;
use App\Events\Common\ReportFilterApplying;
use App\Events\Common\ReportFilterShowing;
use App\Events\Common\ReportGroupApplying;

View File

@ -2,7 +2,7 @@
namespace App\Listeners\Common;
use App\Abstracts\Reports\Listener;
use App\Abstracts\Listeners\Report as Listener;
use App\Events\Common\ReportFilterApplying;
use App\Events\Common\ReportFilterShowing;
use App\Events\Common\ReportGroupApplying;

View File

@ -2,7 +2,7 @@
namespace App\Listeners\Common;
use App\Abstracts\Reports\Listener;
use App\Abstracts\Listeners\Report as Listener;
class ProfitLossReport extends Listener
{

View File

@ -2,7 +2,7 @@
namespace App\Listeners\Common;
use App\Abstracts\Reports\Listener;
use App\Abstracts\Listeners\Report as Listener;
class TaxSummaryReport extends Listener
{

View File

@ -2,8 +2,8 @@
namespace App\Listeners\Update\V10;
use App\Abstracts\Listeners\Update as Listener;
use App\Events\Install\UpdateFinished as Event;
use App\Listeners\Update\Listener;
use File;
class Version106 extends Listener

View File

@ -2,8 +2,8 @@
namespace App\Listeners\Update\V10;
use App\Abstracts\Listeners\Update as Listener;
use App\Events\Install\UpdateFinished as Event;
use App\Listeners\Update\Listener;
use DB;
class Version107 extends Listener

View File

@ -2,8 +2,8 @@
namespace App\Listeners\Update\V10;
use App\Abstracts\Listeners\Update as Listener;
use App\Events\Install\UpdateFinished as Event;
use App\Listeners\Update\Listener;
use App\Models\Common\Company;
use App\Models\Expense\Bill;
use App\Models\Expense\BillStatus;

View File

@ -2,8 +2,8 @@
namespace App\Listeners\Update\V10;
use App\Abstracts\Listeners\Update as Listener;
use App\Events\Install\UpdateFinished as Event;
use App\Listeners\Update\Listener;
use App\Models\Common\Company;
use Artisan;

View File

@ -2,8 +2,8 @@
namespace App\Listeners\Update\V11;
use App\Abstracts\Listeners\Update as Listener;
use App\Events\Install\UpdateFinished as Event;
use App\Listeners\Update\Listener;
use App\Models\Auth\Role;
use App\Models\Auth\Permission;

View File

@ -2,8 +2,8 @@
namespace App\Listeners\Update\V11;
use App\Abstracts\Listeners\Update as Listener;
use App\Events\Install\UpdateFinished as Event;
use App\Listeners\Update\Listener;
use App\Models\Common\Company;
use App\Utilities\Installer;

View File

@ -2,8 +2,8 @@
namespace App\Listeners\Update\V11;
use App\Abstracts\Listeners\Update as Listener;
use App\Events\Install\UpdateFinished as Event;
use App\Listeners\Update\Listener;
use App\Models\Setting\Currency;
use Artisan;

View File

@ -2,8 +2,8 @@
namespace App\Listeners\Update\V11;
use App\Abstracts\Listeners\Update as Listener;
use App\Events\Install\UpdateFinished as Event;
use App\Listeners\Update\Listener;
use App\Models\Auth\Role;
use App\Models\Auth\Permission;
use Illuminate\Support\Facades\Schema;

View File

@ -2,8 +2,8 @@
namespace App\Listeners\Update\V12;
use App\Abstracts\Listeners\Update as Listener;
use App\Events\Install\UpdateFinished as Event;
use App\Listeners\Update\Listener;
use App\Models\Auth\Role;
use App\Models\Auth\Permission;
use App\Models\Common\Company;

View File

@ -2,8 +2,8 @@
namespace App\Listeners\Update\V12;
use App\Abstracts\Listeners\Update as Listener;
use App\Events\Install\UpdateFinished as Event;
use App\Listeners\Update\Listener;
use Artisan;
class Version1210 extends Listener

View File

@ -2,8 +2,8 @@
namespace App\Listeners\Update\V12;
use App\Abstracts\Listeners\Update as Listener;
use App\Events\Install\UpdateFinished as Event;
use App\Listeners\Update\Listener;
use Artisan;
class Version1211 extends Listener

View File

@ -2,8 +2,8 @@
namespace App\Listeners\Update\V12;
use App\Abstracts\Listeners\Update as Listener;
use App\Events\Install\UpdateFinished as Event;
use App\Listeners\Update\Listener;
use App\Models\Auth\Role;
use App\Models\Auth\Permission;

View File

@ -2,8 +2,8 @@
namespace App\Listeners\Update\V12;
use App\Abstracts\Listeners\Update as Listener;
use App\Events\Install\UpdateFinished as Event;
use App\Listeners\Update\Listener;
use App\Models\Auth\Permission;
use File;
use Illuminate\Support\Str;

View File

@ -2,8 +2,8 @@
namespace App\Listeners\Update\V12;
use App\Abstracts\Listeners\Update as Listener;
use App\Events\Install\UpdateFinished as Event;
use App\Listeners\Update\Listener;
use Artisan;
class Version129 extends Listener

View File

@ -2,8 +2,8 @@
namespace App\Listeners\Update\V13;
use App\Abstracts\Listeners\Update as Listener;
use App\Events\Install\UpdateFinished as Event;
use App\Listeners\Update\Listener;
use App\Models\Auth\Role;
use App\Models\Auth\Permission;
use Artisan;

View File

@ -2,8 +2,8 @@
namespace App\Listeners\Update\V13;
use App\Abstracts\Listeners\Update as Listener;
use App\Events\Install\UpdateFinished as Event;
use App\Listeners\Update\Listener;
use App\Models\Auth\Role;
use App\Models\Auth\Permission;
use Artisan;

View File

@ -2,8 +2,8 @@
namespace App\Listeners\Update\V13;
use App\Abstracts\Listeners\Update as Listener;
use App\Events\Install\UpdateFinished as Event;
use App\Listeners\Update\Listener;
use App\Models\Common\Company;
use App\Utilities\Installer;
use Artisan;

View File

@ -2,8 +2,8 @@
namespace App\Listeners\Update\V13;
use App\Abstracts\Listeners\Update as Listener;
use App\Events\Install\UpdateFinished as Event;
use App\Listeners\Update\Listener;
use App\Models\Common\Company;
use App\Utilities\Overrider;
use App\Models\Banking\Account;

View File

@ -2,8 +2,8 @@
namespace App\Listeners\Update\V13;
use App\Abstracts\Listeners\Update as Listener;
use App\Events\Install\UpdateFinished as Event;
use App\Listeners\Update\Listener;
use App\Models\Auth\Role;
use App\Models\Auth\Permission;
use Artisan;

View File

@ -2,8 +2,8 @@
namespace App\Listeners\Update\V13;
use App\Abstracts\Listeners\Update as Listener;
use App\Events\Install\UpdateFinished as Event;
use App\Listeners\Update\Listener;
use Date;
class Version135 extends Listener

View File

@ -2,8 +2,8 @@
namespace App\Listeners\Update\V13;
use App\Abstracts\Listeners\Update as Listener;
use App\Events\Install\UpdateFinished as Event;
use App\Listeners\Update\Listener;
use Date;
class Version138 extends Listener

View File

@ -2,8 +2,8 @@
namespace App\Listeners\Update\V13;
use App\Abstracts\Listeners\Update as Listener;
use App\Events\Install\UpdateFinished as Event;
use App\Listeners\Update\Listener;
use App\Models\Income\InvoiceItem;
use App\Models\Income\InvoiceItemTax;
use App\Models\Setting\Tax;

View File

@ -2,8 +2,8 @@
namespace App\Listeners\Update\V20;
use App\Abstracts\Listeners\Update as Listener;
use App\Events\Install\UpdateFinished as Event;
use App\Listeners\Update\Listener;
use App\Models\Auth\User;
use App\Models\Auth\Role;
use App\Models\Auth\Permission;
@ -32,8 +32,7 @@ class Version200 extends Listener
*/
public function handle(Event $event)
{
// Check if should listen
if (!$this->check($event)) {
if ($this->skipThisUpdate($event)) {
return;
}

View File

@ -2,8 +2,8 @@
namespace App\Listeners\Update\V13;
use App\Abstracts\Listeners\Update as Listener;
use App\Events\Install\UpdateFinished as Event;
use App\Listeners\Update\Listener;
use Artisan;
class Version201 extends Listener
@ -20,8 +20,7 @@ class Version201 extends Listener
*/
public function handle(Event $event)
{
// Check if should listen
if (!$this->check($event)) {
if ($this->skipThisUpdate($event)) {
return;
}

View File

@ -2,7 +2,7 @@
namespace App\Reports;
use App\Abstracts\Reports\Report;
use App\Abstracts\Report;
use App\Models\Banking\Transaction;
use App\Models\Expense\Bill;
use App\Utilities\Recurring;

View File

@ -2,7 +2,7 @@
namespace App\Reports;
use App\Abstracts\Reports\Report;
use App\Abstracts\Report;
use App\Models\Banking\Transaction;
use App\Models\Expense\Bill;
use App\Models\Income\Invoice;

View File

@ -2,7 +2,7 @@
namespace App\Reports;
use App\Abstracts\Reports\Report;
use App\Abstracts\Report;
use App\Models\Banking\Transaction;
use App\Models\Income\Invoice;
use App\Utilities\Recurring;

View File

@ -2,7 +2,7 @@
namespace App\Reports;
use App\Abstracts\Reports\Report;
use App\Abstracts\Report;
use App\Models\Banking\Transaction;
use App\Models\Expense\Bill;
use App\Models\Income\Invoice;

View File

@ -2,7 +2,7 @@
namespace App\Reports;
use App\Abstracts\Reports\Report;
use App\Abstracts\Report;
use App\Models\Banking\Transaction;
use App\Models\Expense\Bill;
use App\Models\Income\Invoice;