Refactor for events

This commit is contained in:
David Bomba 2020-07-08 22:02:16 +10:00
parent a476034bd0
commit f3572a5d11
153 changed files with 765 additions and 283 deletions

View File

@ -26,6 +26,7 @@ use App\Models\PaymentType;
use App\Models\Product;
use App\Models\User;
use App\Repositories\InvoiceRepository;
use App\Utils\Ninja;
use App\Utils\Traits\GeneratesCounter;
use App\Utils\Traits\MakesHash;
use Carbon\Carbon;
@ -510,7 +511,7 @@ class CreateTestData extends Command
}
//@todo this slow things down, but gives us PDFs of the invoices for inspection whilst debugging.
event(new InvoiceWasCreated($invoice, $invoice->company));
event(new InvoiceWasCreated($invoice, $invoice->company, Ninja::eventVars()));
}
private function createCredit($client)

View File

@ -12,6 +12,7 @@ use App\Models\Country;
use App\Models\Product;
use App\Models\User;
use App\Repositories\InvoiceRepository;
use App\Utils\Ninja;
use App\Utils\Traits\GeneratesCounter;
use App\Utils\Traits\MakesHash;
use Carbon\Carbon;
@ -362,7 +363,7 @@ class DemoMode extends Command
}
//@todo this slow things down, but gives us PDFs of the invoices for inspection whilst debugging.
event(new InvoiceWasCreated($invoice, $invoice->company));
event(new InvoiceWasCreated($invoice, $invoice->company, Ninja::eventVars()));
}
private function createCredit($client)

View File

@ -22,6 +22,7 @@ use App\Models\Client;
use App\Models\Payment;
use App\Models\PaymentType;
use App\Models\Product;
use App\Utils\Ninja;
use App\Utils\Traits\MakesHash;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
@ -92,7 +93,7 @@ class CreateTestCreditJob implements ShouldQueue
$credit->save();
event(new CreateCreditInvitation($credit));
event(new CreateCreditInvitation($credit, $credit->company, Ninja::eventVars()));
}

View File

@ -21,6 +21,7 @@ use App\Models\Client;
use App\Models\Payment;
use App\Models\PaymentType;
use App\Models\Product;
use App\Utils\Ninja;
use App\Utils\Traits\MakesHash;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
@ -111,13 +112,13 @@ class CreateTestInvoiceJob implements ShouldQueue
$payment->invoices()->save($invoice);
event(new PaymentWasCreated($payment, $payment->company));
event(new PaymentWasCreated($payment, $payment->company, Ninja::eventVars()));
$payment->service()->updateInvoicePayment();
//UpdateInvoicePayment::dispatchNow($payment, $payment->company);
}
//@todo this slow things down, but gives us PDFs of the invoices for inspection whilst debugging.
event(new InvoiceWasCreated($invoice, $invoice->company));
event(new InvoiceWasCreated($invoice, $invoice->company, Ninja::eventVars()));
}

View File

@ -33,15 +33,18 @@ class AccountCreated
public $user;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct($user, $company)
public function __construct($user, $company, $event_vars)
{
$this->user = $user;
$this->company = $company;
$this->event_vars = $event_vars;
}
/**

View File

@ -34,15 +34,20 @@ class ClientWasArchived
public $client;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Client $client
*/
public function __construct(Client $client, Company $company)
public function __construct(Client $client, Company $company, array $event_vars)
{
$this->client = $client;
$this->company = $company;
$this->event_vars = $event_vars;
}
/**

View File

@ -28,14 +28,19 @@ class ClientWasCreated
public $client;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Client $client
*/
public function __construct(Client $client, Company $company)
public function __construct(Client $client, Company $company, array $event_vars)
{
$this->client = $client;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -27,14 +27,19 @@ class ClientWasDeleted
public $client;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Client $client
*/
public function __construct(Client $client, Company $company)
public function __construct(Client $client, Company $company, array $event_vars)
{
$this->client = $client;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -27,14 +27,19 @@ class ClientWasRestored
public $client;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Client $client
*/
public function __construct(Client $client, Company $company)
public function __construct(Client $client, Company $company, array $event_vars)
{
$this->client = $client;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -27,14 +27,19 @@ class ClientWasUpdated
public $client;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Client $client
*/
public function __construct(Client $client, Company $company)
public function __construct(Client $client, Company $company, array $event_vars)
{
$this->client = $client;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -1,4 +1,13 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\Events\Company;
@ -11,7 +20,7 @@ use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
class CompanyWasDeleted
class CompanyDocumentsDeleted
{
use Dispatchable, InteractsWithSockets, SerializesModels;

View File

@ -35,15 +35,17 @@ class ContactLoggedIn
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct(ClientContact $client_contact, $company)
public function __construct(ClientContact $client_contact, $company, $event_vars)
{
$this->client_contact = $client_contact;
$this->company = $company;
$this->event_vars = $event_vars;
}
/**

View File

@ -1,4 +1,14 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\Events\Credit;
@ -16,14 +26,16 @@ class CreditWasCreated
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Credit $credit
*/
public function __construct(Credit $credit, Company $company)
public function __construct(Credit $credit, Company $company, array $event_vars)
{
$this->credit = $credit;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -1,4 +1,13 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\Events\Credit;
@ -14,15 +23,17 @@ class CreditWasEmailed
public $credit;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @return void
* @param Credit $credit
*/
public function __construct(Credit $credit, $company)
public function __construct(Credit $credit, Company $company, array $event_vars)
{
$this->credit = $credit;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -1,4 +1,13 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\Events\Credit;
@ -17,12 +26,16 @@ class CreditWasEmailedAndFailed
public $company;
public function __construct(Credit $credit, $company, array $errors)
public $event_vars;
public function __construct(Credit $credit, $company, array $errors, array $event_vars)
{
$this->credit = $credit;
$this->company = $company;
$this->errors = $errors;
$this->event_vars = $event_vars;
}
}

View File

@ -1,4 +1,14 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\Events\Credit;
use App\Models\Company;
@ -15,16 +25,19 @@ class CreditWasMarkedSent
* @var Credit
*/
public $credit;
public $company;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Quote $credit
* @param Credit $credit
*/
public function __construct(Credit $credit, Company $company)
public function __construct(Credit $credit, Company $company, array $event_vars)
{
$this->credit = $credit;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -1,4 +1,13 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\Events\Credit;
@ -15,10 +24,17 @@ class CreditWasUpdated
public $credit;
public $company;
public function __construct(Credit $credit, Company $company)
public $event_vars;
/**
* Create a new event instance.
*
* @param Credit $credit
*/
public function __construct(Credit $credit, Company $company, array $event_vars)
{
$this->invoice = $credit;
$this->credit = $credit;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -11,14 +11,15 @@
namespace App\Events\Design;
use App\Models\Company;
use App\Models\Design;
use Illuminate\Broadcasting\Channel;
use Illuminate\Queue\SerializesModels;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
/**
* Class DesignWasArchived.
@ -33,16 +34,20 @@ class DesignWasArchived
public $design;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Design $design
*/
public function __construct(Design $design, $company)
public function __construct(Design $design, Company $company, array $event_vars)
{
$this->design = $design;
$this->company = $company;
$this->event_vars = $event_vars;
}
/**

View File

@ -11,6 +11,7 @@
namespace App\Events\Design;
use App\Models\Company;
use App\Models\Design;
use Illuminate\Queue\SerializesModels;
@ -27,16 +28,20 @@ class DesignWasCreated
public $design;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Design $design
*/
public function __construct(Design $design, $company)
public function __construct(Design $design, Company $company, array $event_vars)
{
$this->design = $design;
$this->company = $company;
$this->event_vars = $event_vars;
}
/**

View File

@ -11,6 +11,7 @@
namespace App\Events\Design;
use App\Models\Company;
use App\Models\Design;
use Illuminate\Queue\SerializesModels;
@ -27,16 +28,20 @@ class DesignWasDeleted
public $design;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Design $design
*/
public function __construct(Design $design, $company)
public function __construct(Design $design, Company $company, array $event_vars)
{
$this->design = $design;
$this->company = $company;
$this->event_vars = $event_vars;
}
/**

View File

@ -11,6 +11,7 @@
namespace App\Events\Design;
use App\Models\Company;
use App\Models\Design;
use Illuminate\Queue\SerializesModels;
@ -20,23 +21,27 @@ use Illuminate\Queue\SerializesModels;
class DesignWasRestored
{
use SerializesModels;
/**
* @var Design
*/
public $design;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Design $design
*/
public function __construct(Design $design, $company)
public function __construct(Design $design, Company $company, array $event_vars)
{
$this->design = $design;
$this->company = $company;
$this->event_vars = $event_vars;
}
/**

View File

@ -11,6 +11,7 @@
namespace App\Events\Design;
use App\Models\Company;
use App\Models\Design;
use Illuminate\Queue\SerializesModels;
@ -27,18 +28,21 @@ class DesignWasUpdated
public $design;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Design $design
*/
public function __construct(Design $design, $company)
public function __construct(Design $design, Company $company, array $event_vars)
{
$this->design = $design;
$this->company = $company;
}
$this->event_vars = $event_vars;
}
/**
* Get the channels the event should broadcast on.
*

View File

@ -11,14 +11,15 @@
namespace App\Events\Document;
use App\Models\Company;
use App\Models\Document;
use Illuminate\Broadcasting\Channel;
use Illuminate\Queue\SerializesModels;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
/**
* Class DocumentWasArchived.
@ -33,15 +34,19 @@ class DocumentWasArchived
public $document;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Document $document
*/
public function __construct(Document $document, $company)
public function __construct(Document $document, Company $company, array $event_vars)
{
$this->document = $document;
$this->company = $company;
$this->event_vars = $event_vars;
}
/**

View File

@ -11,6 +11,7 @@
namespace App\Events\Document;
use App\Models\Company;
use App\Models\Document;
use Illuminate\Queue\SerializesModels;
@ -27,14 +28,18 @@ class DocumentWasCreated
public $document;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Document $document
*/
public function __construct(Document $document, $company)
public function __construct(Document $document, Company $company, array $event_vars)
{
$this->document = $document;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -11,6 +11,7 @@
namespace App\Events\Document;
use App\Models\Company;
use App\Models\Document;
use Illuminate\Queue\SerializesModels;
@ -27,14 +28,18 @@ class DocumentWasDeleted
public $document;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Document $document
*/
public function __construct(Document $document, $company)
public function __construct(Document $document, Company $company, array $event_vars)
{
$this->document = $document;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -11,6 +11,7 @@
namespace App\Events\Document;
use App\Models\Company;
use App\Models\Document;
use Illuminate\Queue\SerializesModels;
@ -27,14 +28,18 @@ class DocumentWasRestored
public $document;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Document $document
*/
public function __construct(Document $document, $company)
public function __construct(Document $document, Company $company, array $event_vars)
{
$this->document = $document;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -11,6 +11,7 @@
namespace App\Events\Document;
use App\Models\Company;
use App\Models\Document;
use Illuminate\Queue\SerializesModels;
@ -27,14 +28,18 @@ class DocumentWasUpdated
public $document;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Document $document
*/
public function __construct(Document $document, $company)
public function __construct(Document $document, Company $company, array $event_vars)
{
$this->document = $document;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -11,6 +11,7 @@
namespace App\Events\Expense;
use App\Models\Company;
use App\Models\Expense;
use Illuminate\Queue\SerializesModels;
@ -27,14 +28,17 @@ class ExpenseWasArchived
public $expense;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Expense $expense
*/
public function __construct(Expense $expense, $company)
public function __construct(Expense $expense, Company $company, array $event_vars)
{
$this->expense = $expense;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -11,6 +11,7 @@
namespace App\Events\Expense;
use App\Models\Company;
use App\Models\Expense;
use Illuminate\Queue\SerializesModels;
@ -27,14 +28,17 @@ class ExpenseWasCreated
public $expense;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Expense $expense
*/
public function __construct(Expense $expense, $company)
public function __construct(Expense $expense, Company $company, array $event_vars)
{
$this->expense = $expense;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -11,6 +11,7 @@
namespace App\Events\Expense;
use App\Models\Company;
use App\Models\Expense;
use Illuminate\Queue\SerializesModels;
@ -27,14 +28,17 @@ class ExpenseWasDeleted
public $expense;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Expense $expense
*/
public function __construct(Expense $expense, $company)
public function __construct(Expense $expense, Company $company, array $event_vars)
{
$this->expense = $expense;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -11,6 +11,7 @@
namespace App\Events\Expense;
use App\Models\Company;
use App\Models\Expense;
use Illuminate\Queue\SerializesModels;
@ -27,14 +28,17 @@ class ExpenseWasRestored
public $expense;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Expense $expense
*/
public function __construct(Expense $expense, $company)
public function __construct(Expense $expense, Company $company, array $event_vars)
{
$this->expense = $expense;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -11,6 +11,7 @@
namespace App\Events\Expense;
use App\Models\Company;
use App\Models\Expense;
use Illuminate\Queue\SerializesModels;
@ -27,14 +28,17 @@ class ExpenseWasUpdated
public $expense;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Expense $expense
*/
public function __construct(Expense $expense, $company)
public function __construct(Expense $expense, Company $company, array $event_vars)
{
$this->expense = $expense;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -11,6 +11,7 @@
namespace App\Events\Invoice;
use App\Models\Company;
use App\Models\Invoice;
use Illuminate\Queue\SerializesModels;
@ -27,14 +28,17 @@ class InvoiceWasArchived
public $invoice;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Invoice $invoice
*/
public function __construct(Invoice $invoice, $company)
public function __construct(Invoice $invoice, Company $company, array $event_vars)
{
$this->invoice = $invoice;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -11,6 +11,7 @@
namespace App\Events\Invoice;
use App\Models\Company;
use App\Models\Invoice;
use Illuminate\Queue\SerializesModels;
@ -27,14 +28,17 @@ class InvoiceWasCancelled
public $invoice;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Invoice $invoice
*/
public function __construct(Invoice $invoice, $company)
public function __construct(Invoice $invoice, Company $company, array $event_vars)
{
$this->invoice = $invoice;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -28,14 +28,17 @@ class InvoiceWasCreated
public $invoice;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Invoice $invoice
*/
public function __construct(Invoice $invoice, Company $company)
public function __construct(Invoice $invoice, Company $company, array $event_vars)
{
$this->invoice = $invoice;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -11,6 +11,7 @@
namespace App\Events\Invoice;
use App\Models\Company;
use App\Models\Invoice;
use Illuminate\Queue\SerializesModels;
@ -27,14 +28,17 @@ class InvoiceWasDeleted
public $invoice;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Invoice $invoice
*/
public function __construct(Invoice $invoice, $company)
public function __construct(Invoice $invoice, Company $company, array $event_vars)
{
$this->invoice = $invoice;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -11,6 +11,7 @@
namespace App\Events\Invoice;
use App\Models\Company;
use App\Models\InvoiceInvitation;
use Illuminate\Queue\SerializesModels;
@ -27,14 +28,17 @@ class InvoiceWasEmailed
public $invitation;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Invoice $invoice
*/
public function __construct(InvoiceInvitation $invitation, $company)
public function __construct(InvoiceInvitation $invitation, Company $company, array $event_vars)
{
$this->invitation = $invitation;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -11,6 +11,7 @@
namespace App\Events\Invoice;
use App\Models\Company;
use App\Models\Invoice;
use Illuminate\Queue\SerializesModels;
@ -31,19 +32,22 @@ class InvoiceWasEmailedAndFailed
*/
public $errors;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Invoice $invoice
*/
public function __construct(Invoice $invoice, $company, array $errors)
public function __construct(Invoice $invoice, Company $company, array $errors, array $event_vars)
{
$this->invoice = $invoice;
$this->company = $company;
$this->errors = $errors;
$this->event_vars = $event_vars;
}
}

View File

@ -29,15 +29,16 @@ class InvoiceWasMarkedSent
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Invoice $invoice
*/
public function __construct(Invoice $invoice, Company $company)
public function __construct(Invoice $invoice, Company $company, array $event_vars)
{
$this->invoice = $invoice;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -29,14 +29,16 @@ class InvoiceWasPaid
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Invoice $invoice
*/
public function __construct(Invoice $invoice, Company $company)
public function __construct(Invoice $invoice, Company $company, array $event_vars)
{
$this->invoice = $invoice;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -11,6 +11,7 @@
namespace App\Events\Invoice;
use App\Models\Company;
use App\Models\Invoice;
use Illuminate\Queue\SerializesModels;
@ -29,16 +30,19 @@ class InvoiceWasRestored
public $fromDeleted;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Invoice $invoice
* @param $fromDeleted
*/
public function __construct(Invoice $invoice, $fromDeleted, $company)
public function __construct(Invoice $invoice, $fromDeleted, Company $company, array $event_vars)
{
$this->invoice = $invoice;
$this->fromDeleted = $fromDeleted;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -11,6 +11,7 @@
namespace App\Events\Invoice;
use App\Models\Company;
use App\Models\Invoice;
use Illuminate\Queue\SerializesModels;
@ -27,14 +28,17 @@ class InvoiceWasReversed
public $invoice;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Invoice $invoice
*/
public function __construct(Invoice $invoice, $company)
public function __construct(Invoice $invoice, Company $company, array $event_vars)
{
$this->invoice = $invoice;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -28,14 +28,17 @@ class InvoiceWasUpdated
public $invoice;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Invoice $invoice
*/
public function __construct(Invoice $invoice, Company $company)
public function __construct(Invoice $invoice, Company $company, array $event_vars)
{
$this->invoice = $invoice;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -29,15 +29,18 @@ class InvitationWasViewed
public $entity;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Invoice $invoice
*/
public function __construct($entity, $invitation, $company)
public function __construct($entity, $invitation, $company, $event_vars)
{
$this->entity = $entity;
$this->invitation = $invitation;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -1,8 +1,18 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\Events\Payment\Methods;
use App\Models\ClientGatewayToken;
use App\Models\Company;
use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PresenceChannel;
@ -21,15 +31,18 @@ class MethodDeleted
private $payment_method;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param ClientGatewayToken $payment_method
*/
public function __construct(ClientGatewayToken $payment_method, $company)
public function __construct(ClientGatewayToken $payment_method, Company $company, array $event_vars)
{
$this->payment_method = $payment_method;
$this->company = $company;
$this->event_vars = $event_vars;
}
/**

View File

@ -11,6 +11,7 @@
namespace App\Events\Payment;
use App\Models\Company;
use App\Models\Payment;
use Illuminate\Queue\SerializesModels;
@ -26,15 +27,18 @@ class PaymentCompleted
*/
public $payment;
public $company
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Payment $payment
*/
public function __construct(Payment $payment, $company)
public function __construct(Payment $payment, Company $company, array $event_vars)
{
$this->payment = $payment;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -11,6 +11,7 @@
namespace App\Events\Payment;
use App\Models\Company;
use App\Models\Payment;
use Illuminate\Queue\SerializesModels;
@ -21,20 +22,24 @@ class PaymentFailed
{
use SerializesModels;
/**
* @var Payment
*/
public $payment;
public $company
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Payment $payment
*/
public function __construct(Payment $payment, $company)
public function __construct(Payment $payment, Company $company, array $event_vars)
{
$this->payment = $payment;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -11,6 +11,7 @@
namespace App\Events\Payment;
use App\Models\Company;
use App\Models\Payment;
use Illuminate\Queue\SerializesModels;
@ -21,20 +22,24 @@ class PaymentWasArchived
{
use SerializesModels;
/**
* @var Payment
*/
public $payment;
public $company
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Payment $payment
*/
public function __construct(Payment $payment, $company)
public function __construct(Payment $payment, Company $company, array $event_vars)
{
$this->payment = $payment;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -23,19 +23,22 @@ class PaymentWasCreated
use SerializesModels;
/**
* @var array $payment
* @var Payment
*/
public $payment;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Payment $payment
*/
public function __construct(Payment $payment, Company $company)
public function __construct(Payment $payment, Company $company, array $event_vars)
{
$this->payment = $payment;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -11,6 +11,7 @@
namespace App\Events\Payment;
use App\Models\Company;
use App\Models\Payment;
use Illuminate\Queue\SerializesModels;
@ -21,20 +22,24 @@ class PaymentWasDeleted
{
use SerializesModels;
/**
* @var Payment
*/
public $payment;
public $company
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Payment $payment
*/
public function __construct(Payment $payment, $company)
public function __construct(Payment $payment, Company $company, array $event_vars)
{
$this->payment = $payment;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -11,6 +11,7 @@
namespace App\Events\Payment;
use App\Models\Company;
use App\Models\Payment;
use Illuminate\Queue\SerializesModels;
@ -21,20 +22,24 @@ class PaymentWasEmailed
{
use SerializesModels;
/**
* @var Payment
*/
public $payment;
public $company
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Payment $payment
*/
public function __construct(Payment $payment, $company)
public function __construct(Payment $payment, Company $company, array $event_vars)
{
$this->payment = $payment;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -26,23 +26,24 @@ class PaymentWasEmailedAndFailed
*/
public $payment;
/**
* @var array
*/
public $errors;
public $company;
public $event_vars;
/**
* PaymentWasEmailedAndFailed constructor.
* @param Payment $payment
* @param array $errors
*/
public function __construct(Payment $payment, $company, array $errors)
public function __construct(Payment $payment, $company, array $errors, array $event_vars)
{
$this->payment = $payment;
$this->errors = $errors;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -11,6 +11,7 @@
namespace App\Events\Payment;
use App\Models\Company;
use App\Models\Payment;
use Illuminate\Queue\SerializesModels;
@ -29,16 +30,19 @@ class PaymentWasRefunded
public $refund_amount;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Payment $payment
* @param $refund_amount
*/
public function __construct(Payment $payment, $refund_amount, $company)
public function __construct(Payment $payment, float $refund_amount, Company $company, array $event_vars)
{
$this->payment = $payment;
$this->refund_amount = $refund_amount;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -11,6 +11,7 @@
namespace App\Events\Payment;
use App\Models\Company;
use App\Models\Payment;
use Illuminate\Queue\SerializesModels;
@ -27,16 +28,18 @@ class PaymentWasRestored
public $payment;
public $fromDeleted;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Payment $payment
* @param $fromDeleted
*/
public function __construct(Payment $payment, $fromDeleted, $company)
public function __construct(Payment $payment, $fromDeleted, Company $company, array $event_vars)
{
$this->payment = $payment;
$this->fromDeleted = $fromDeleted;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -11,6 +11,7 @@
namespace App\Events\Payment;
use App\Models\Company;
use App\Models\Payment;
use Illuminate\Queue\SerializesModels;
@ -21,20 +22,24 @@ class PaymentWasVoided
{
use SerializesModels;
/**
* @var Payment
*/
public $payment;
public $company
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Payment $payment
*/
public function __construct(Payment $payment, $company)
public function __construct(Payment $payment, Company $company, array $event_vars)
{
$this->payment = $payment;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -0,0 +1,40 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\Events\Product;
use App\Models\Product;
use Illuminate\Queue\SerializesModels;
class ProductWasArchived
{
use SerializesModels;
/**
* @var Product
*/
public $product;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct(Product $product, Company $company, array $event_vars)
{
$this->product = $product;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -11,6 +11,7 @@
namespace App\Events\Product;
use App\Models\Company;
use App\Models\Product;
use Illuminate\Queue\SerializesModels;
@ -23,22 +24,21 @@ class ProductWasCreated
*/
public $product;
/**
* @var array
**/
public $input;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct(Product $product, $input = null, $company)
public function __construct(Product $product, $input = null, Company $company, array $event_vars)
{
$this->product = $product;
$this->input = $input;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -11,6 +11,7 @@
namespace App\Events\Product;
use App\Models\Company;
use App\Models\Product;
use Illuminate\Queue\SerializesModels;
@ -24,14 +25,17 @@ class ProductWasDeleted
public $product;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct(Product $product, $company)
public function __construct(Product $product, Company $company, array $event_vars)
{
$this->product = $product;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -23,22 +23,18 @@ class ProductWasUpdated
*/
public $product;
/**
* @var array
**/
public $input;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct(Product $product, $input = null, $company)
public function __construct(Product $product, Company $company, array $event_vars)
{
$this->product = $product;
$this->input = $input;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -1,7 +1,17 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\Events\Quote;
use App\Models\Company;
use App\Models\Quote;
use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
@ -18,14 +28,17 @@ class QuoteWasApproved
public $quote;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct(Quote $quote, $company)
public function __construct(Quote $quote, Company $company, array $event_vars)
{
$this->quote = $quote;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -11,6 +11,7 @@
namespace App\Events\Quote;
use App\Models\Company;
use Illuminate\Queue\SerializesModels;
class QuoteWasArchived
@ -18,15 +19,19 @@ class QuoteWasArchived
use SerializesModels;
public $quote;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct(Quote $quote, $company)
public function __construct(Quote $quote, Company $company, array $event_vars)
{
$this->quote = $quote;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -11,6 +11,7 @@
namespace App\Events\Quote;
use App\Models\Company;
use Illuminate\Queue\SerializesModels;
/**
@ -21,15 +22,19 @@ class QuoteWasCreated
use SerializesModels;
public $quote;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct(Quote $quote, $company)
public function __construct(Quote $quote, Company $company, array $event_vars)
{
$this->quote = $quote;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -11,6 +11,7 @@
namespace App\Events\Quote;
use App\Models\Company;
use Illuminate\Queue\SerializesModels;
/**
@ -19,17 +20,21 @@ use Illuminate\Queue\SerializesModels;
class QuoteWasDeleted
{
use SerializesModels;
public $quote;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct(Quote $quote, $company)
public function __construct(Quote $quote, Company $company, array $event_vars)
{
$this->quote = $quote;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -11,6 +11,8 @@
namespace App\Events\Quote;
use App\Models\Company;
use App\Models\Quote;
use Illuminate\Queue\SerializesModels;
/**
@ -24,21 +26,20 @@ class QuoteWasEmailed
public $company;
/**
* @var string
*/
public $notes;
public $event_vars;
/**
* Create a new event instance.
*
* @param $quote
*/
public function __construct($quote, $notes, $company)
public function __construct(Quote $quote, string $notes, Company $company, array $event_vars)
{
$this->quote = $quote;
$this->notes = $notes;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -11,6 +11,7 @@
namespace App\Events\Quote;
use App\Models\Company;
use App\Models\Quote;
use Illuminate\Queue\SerializesModels;
@ -28,22 +29,22 @@ class QuoteWasEmailedAndFailed
public $company;
/**
* @var array
*/
public $errors;
public $event_vars;
/**
* QuoteWasEmailedAndFailed constructor.
* @param Quote $quote
* @param array $errors
*/
public function __construct(Quote $quote, array $errors, $company)
public function __construct(Quote $quote, array $errors, Company $company, array $event_vars)
{
$this->quote = $quote;
$this->errors = $errors;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -1,4 +1,14 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\Events\Quote;
use App\Models\Company;
@ -11,21 +21,21 @@ use Illuminate\Queue\SerializesModels;
class QuoteWasMarkedApproved
{
use SerializesModels;
/**
* @var Quote
*/
public $quote;
public $company;
public $event_vars;
/**
* QuoteWasMarkedApproved constructor.
* @param Quote $quote
* @param Company $company
* Create a new event instance.
*
* @return void
*/
public function __construct(Quote $quote, Company $company)
public function __construct(Quote $quote, Company $company, array $event_vars)
{
$this->quote = $quote;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -1,4 +1,14 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com)
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\Events\Quote;
use App\Models\Company;
@ -11,20 +21,21 @@ use Illuminate\Queue\SerializesModels;
class QuoteWasMarkedSent
{
use SerializesModels;
/**
* @var Invoice
*/
public $quote;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Quote $quote
* @return void
*/
public function __construct(Quote $quote, Company $company)
public function __construct(Quote $quote, Company $company, array $event_vars)
{
$this->quote = $quote;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -11,6 +11,7 @@
namespace App\Events\Quote;
use App\Models\Company;
use Illuminate\Queue\SerializesModels;
/**
@ -19,17 +20,21 @@ use Illuminate\Queue\SerializesModels;
class QuoteWasRestored
{
use SerializesModels;
public $quote;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct(Quote $quote, $company)
public function __construct(Quote $quote, Company $company, array $event_vars)
{
$this->quote = $quote;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -19,16 +19,21 @@ use Illuminate\Queue\SerializesModels;
class QuoteWasUpdated
{
use SerializesModels;
public $quote;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct(Quote $quote, $company)
public function __construct(Quote $quote, Company $company, array $event_vars)
{
$this->quote = $quote;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -11,6 +11,7 @@
namespace App\Events\Task;
use App\Models\Company;
use App\Models\Task;
use Illuminate\Queue\SerializesModels;
@ -28,14 +29,16 @@ class TaskWasArchived
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Task $task
*/
public function __construct(Task $task, $company)
public function __construct(Task $task, Company $company, array $event_vars)
{
$this->task = $task;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -11,6 +11,7 @@
namespace App\Events\Task;
use App\Models\Company;
use App\Models\Task;
use Illuminate\Queue\SerializesModels;
@ -20,7 +21,7 @@ use Illuminate\Queue\SerializesModels;
class TaskWasCreated
{
use SerializesModels;
/**
* @var Task
*/
@ -28,14 +29,16 @@ class TaskWasCreated
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Task $task
*/
public function __construct(Task $task, $company)
public function __construct(Task $task, Company $company, array $event_vars)
{
$this->task = $task;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -11,6 +11,7 @@
namespace App\Events\Task;
use App\Models\Company;
use App\Models\Task;
use Illuminate\Queue\SerializesModels;
@ -28,14 +29,16 @@ class TaskWasDeleted
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Task $task
*/
public function __construct(Task $task, $company)
public function __construct(Task $task, Company $company, array $event_vars)
{
$this->task = $task;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -11,6 +11,7 @@
namespace App\Events\Task;
use App\Models\Company;
use App\Models\Task;
use Illuminate\Queue\SerializesModels;
@ -28,14 +29,16 @@ class TaskWasRestored
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Task $task
*/
public function __construct(Task $task, $company)
public function __construct(Task $task, Company $company, array $event_vars)
{
$this->task = $task;
$this->company = $company;
$this->event_vars = $event_vars;
}
}
}

View File

@ -11,6 +11,7 @@
namespace App\Events\Task;
use App\Models\Company;
use App\Models\Task;
use Illuminate\Queue\SerializesModels;
@ -28,14 +29,16 @@ class TaskWasUpdated
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Task $task
*/
public function __construct(Task $task, $company)
public function __construct(Task $task, Company $company, array $event_vars)
{
$this->task = $task;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -11,13 +11,15 @@
namespace App\Events\User;
use App\Models\Company;
use App\Models\User;
use Illuminate\Broadcasting\Channel;
use Illuminate\Queue\SerializesModels;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
/**
* Class UserLoggedIn
@ -33,15 +35,18 @@ class UserLoggedIn
public $user;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct($user, $company)
public function __construct(User $user, Company $company, array $event_vars)
{
$this->user = $user;
$this->company = $company;
$this->event_vars = $event_vars;
}
/**

View File

@ -11,13 +11,15 @@
namespace App\Events\User;
use App\Models\Company;
use App\Models\User;
use Illuminate\Broadcasting\Channel;
use Illuminate\Queue\SerializesModels;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
/**
* Class UserWasArchived
@ -32,20 +34,19 @@ class UserWasArchived
*/
public $user;
/**
* @var $company
*/
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct($user, $company)
public function __construct(User $user, Company $company, array $event_vars)
{
$this->user = $user;
$this->company = $company;
$this->event_vars = $event_vars;
}
/**

View File

@ -11,13 +11,15 @@
namespace App\Events\User;
use App\Models\Company;
use App\Models\User;
use Illuminate\Broadcasting\Channel;
use Illuminate\Queue\SerializesModels;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
/**
* Class UserWasCreated
@ -32,20 +34,19 @@ class UserWasCreated
*/
public $user;
/**
* @var $company
*/
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct($user, $company)
public function __construct(User $user, Company $company, array $event_vars)
{
$this->user = $user;
$this->company = $company;
$this->event_vars = $event_vars;
}
/**

View File

@ -11,13 +11,15 @@
namespace App\Events\User;
use App\Models\Company;
use App\Models\User;
use Illuminate\Broadcasting\Channel;
use Illuminate\Queue\SerializesModels;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
/**
* Class UserWasDeleted
@ -32,20 +34,19 @@ class UserWasDeleted
*/
public $user;
/**
* @var $company
*/
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct($user, $company)
public function __construct(User $user, Company $company, array $event_vars)
{
$this->user = $user;
$this->company = $company;
$this->event_vars = $event_vars;
}
/**

View File

@ -11,13 +11,15 @@
namespace App\Events\User;
use App\Models\Company;
use App\Models\User;
use Illuminate\Broadcasting\Channel;
use Illuminate\Queue\SerializesModels;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
/**
* Class UserWasRestored
@ -32,20 +34,19 @@ class UserWasRestored
*/
public $user;
/**
* @var $company
*/
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct($user, $company)
public function __construct(User $user, Company $company, array $event_vars)
{
$this->user = $user;
$this->company = $company;
$this->event_vars = $event_vars;
}
/**

View File

@ -11,13 +11,15 @@
namespace App\Events\User;
use App\Models\Company;
use App\Models\User;
use Illuminate\Broadcasting\Channel;
use Illuminate\Queue\SerializesModels;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
/**
* Class UserWasUpdated
@ -32,22 +34,20 @@ class UserWasUpdated
*/
public $user;
/**
* @var $company
*/
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct($user, $company)
public function __construct(User $user, Company $company, array $event_vars)
{
$this->user = $user;
$this->company = $company;
$this->event_vars = $event_vars;
}
/**
* Get the channels the event should broadcast on.
*

View File

@ -11,6 +11,7 @@
namespace App\Events\Vendor;
use App\Models\Company;
use App\Models\Vendor;
use Illuminate\Queue\SerializesModels;
@ -28,14 +29,17 @@ class VendorWasArchived
public $vendor;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Vendor $vendor
*/
public function __construct(Vendor $vendor, $company)
public function __construct(Vendor $vendor, Company $company, array $event_vars)
{
$this->vendor = $vendor;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -11,6 +11,7 @@
namespace App\Events\Vendor;
use App\Models\Company;
use App\Models\Vendor;
use Illuminate\Queue\SerializesModels;
@ -27,14 +28,17 @@ class VendorWasCreated
public $vendor;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Vendor $vendor
*/
public function __construct(Vendor $vendor, $company)
public function __construct(Vendor $vendor, Company $company, array $event_vars)
{
$this->vendor = $vendor;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -11,6 +11,7 @@
namespace App\Events\Vendor;
use App\Models\Company;
use App\Models\Vendor;
use Illuminate\Queue\SerializesModels;
@ -27,14 +28,17 @@ class VendorWasDeleted
public $vendor;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Vendor $vendor
*/
public function __construct(Vendor $vendor, $company)
public function __construct(Vendor $vendor, Company $company, array $event_vars)
{
$this->vendor = $vendor;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -11,6 +11,7 @@
namespace App\Events\Vendor;
use App\Models\Company;
use App\Models\Vendor;
use Illuminate\Queue\SerializesModels;
@ -27,14 +28,18 @@ class VendorWasRestored
public $vendor;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Vendor $vendor
*/
public function __construct(Vendor $vendor, $company)
public function __construct(Vendor $vendor, Company $company, array $event_vars)
{
$this->vendor = $vendor;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -11,6 +11,7 @@
namespace App\Events\Vendor;
use App\Models\Company;
use App\Models\Vendor;
use Illuminate\Queue\SerializesModels;
@ -27,14 +28,17 @@ class VendorWasUpdated
public $vendor;
public $company;
public $event_vars;
/**
* Create a new event instance.
*
* @param Vendor $vendor
*/
public function __construct(Vendor $vendor, $company)
public function __construct(Vendor $vendor, Company $company, array $event_vars)
{
$this->vendor = $vendor;
$this->company = $company;
$this->event_vars = $event_vars;
}
}

View File

@ -14,6 +14,7 @@ namespace App\Http\Controllers\Auth;
use App\Events\Contact\ContactLoggedIn;
use App\Http\Controllers\Controller;
use App\Models\ClientContact;
use App\Utils\Ninja;
use Auth;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Http\Request;
@ -63,7 +64,7 @@ class ContactLoginController extends Controller
{
Auth::guard('contact')->login($client, true);
event(new ContactLoggedIn($client, $client->company));
event(new ContactLoggedIn($client, $client->company, Ninja::eventVars()));
if (session()->get('url.intended')) {
return redirect(session()->get('url.intended'));

View File

@ -12,6 +12,7 @@
namespace App\Http\Controllers;
use App\DataMapper\ClientSettings;
use App\Events\Client\ClientWasCreated;
use App\Factory\ClientFactory;
use App\Filters\ClientFilters;
use App\Http\Requests\Client\BulkClientRequest;
@ -34,6 +35,7 @@ use App\Models\Size;
use App\Repositories\BaseRepository;
use App\Repositories\ClientRepository;
use App\Transformers\ClientTransformer;
use App\Utils\Ninja;
use App\Utils\Traits\BulkOptions;
use App\Utils\Traits\MakesHash;
use App\Utils\Traits\Uploadable;
@ -384,6 +386,8 @@ class ClientController extends BaseController
$this->uploadLogo($request->file('company_logo'), $client->company, $client);
event(new ClientWasCreated($client, $client->company, Ninja::eventVars()));
return $this->itemResponse($client);
}

View File

@ -14,6 +14,7 @@ namespace App\Http\Controllers\ClientPortal;
use App\Events\Misc\InvitationWasViewed;
use App\Http\Controllers\Controller;
use App\Models\InvoiceInvitation;
use App\Utils\Ninja;
use App\Utils\Traits\MakesDates;
use App\Utils\Traits\MakesHash;
use Illuminate\Http\Request;
@ -47,7 +48,7 @@ class InvitationController extends Controller
if (!request()->has('silent')) {
$invitation->markViewed();
event(new InvitationWasViewed($entity, $invitation, $entity->company));
event(new InvitationWasViewed($entity, $invitation, $entity->company, Ninja::eventVars()));
}
return redirect()->route('client.'.$entity.'.show', [$entity => $this->encodePrimaryKey($invitation->{$key})]);

View File

@ -19,6 +19,7 @@ use App\Models\ClientGatewayToken;
use App\Models\CompanyGateway;
use App\Models\GatewayType;
use App\PaymentDrivers\AuthorizePaymentDriver;
use App\Utils\Ninja;
use App\Utils\Traits\MakesDates;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
@ -135,7 +136,7 @@ class PaymentMethodController extends Controller
public function destroy(ClientGatewayToken $payment_method)
{
try {
event(new MethodDeleted($payment_method, auth('contact')->user()->company));
event(new MethodDeleted($payment_method, auth('contact')->user()->company, Ninja::eventVars()));
$payment_method->delete();
} catch (\Exception $e) {
Log::error(json_encode($e));

View File

@ -8,6 +8,7 @@ use App\Http\Requests\ClientPortal\ProcessQuotesInBulkRequest;
use App\Http\Requests\ClientPortal\ShowQuoteRequest;
use App\Models\Company;
use App\Models\Quote;
use App\Utils\Ninja;
use App\Utils\TempFile;
use App\Utils\Traits\MakesHash;
use ZipStream\Option\Archive;
@ -108,7 +109,7 @@ class QuoteController extends Controller
if ($process) {
foreach ($quotes as $quote) {
$quote->service()->approve()->save();
event(new QuoteWasApproved($quote));
event(new QuoteWasApproved($quote, $quote->company, Ninja::eventVars()));
}
return route('client.quotes.index')->withSuccess('Quote(s) approved successfully.');

View File

@ -482,8 +482,7 @@ class CompanyController extends BaseController
$account->delete();
} else {
$company_id = $company->id;
$company->delete();

View File

@ -22,6 +22,7 @@ use App\Models\Client;
use App\Models\Credit;
use App\Repositories\CreditRepository;
use App\Transformers\CreditTransformer;
use App\Utils\Ninja;
use App\Utils\TempFile;
use App\Utils\Traits\MakesHash;
@ -191,7 +192,7 @@ class CreditController extends BaseController
$credit = StoreCredit::dispatchNow($credit, $request->all(), $credit->company);
event(new CreditWasCreated($credit, $credit->company));
event(new CreditWasCreated($credit, $credit->company, Ninja::eventVars()));
return $this->itemResponse($credit);
}
@ -369,7 +370,7 @@ class CreditController extends BaseController
$credit = $this->credit_repository->save($request->all(), $credit);
event(new CreditWasUpdated($credit, $credit->company));
event(new CreditWasUpdated($credit, $credit->company, Ninja::eventVars()));
return $this->itemResponse($credit);
}

View File

@ -36,6 +36,7 @@ use App\Models\Invoice;
use App\Models\InvoiceInvitation;
use App\Repositories\InvoiceRepository;
use App\Transformers\InvoiceTransformer;
use App\Utils\Ninja;
use App\Utils\TempFile;
use App\Utils\Traits\MakesHash;
use Illuminate\Http\Request;
@ -213,7 +214,7 @@ class InvoiceController extends BaseController
$invoice = $this->invoice_repo->save($request->all(), InvoiceFactory::create(auth()->user()->company()->id, auth()->user()->id));
event(new InvoiceWasCreated($invoice, $invoice->company));
event(new InvoiceWasCreated($invoice, $invoice->company, Ninja::eventVars()));
$invoice = $invoice->service()->triggeredActions($request)->save();
@ -393,7 +394,7 @@ class InvoiceController extends BaseController
$invoice = $this->invoice_repo->save($request->all(), $invoice);
event(new InvoiceWasUpdated($invoice, $invoice->company));
event(new InvoiceWasUpdated($invoice, $invoice->company, Ninja::eventVars()));
return $this->itemResponse($invoice);
}
@ -718,7 +719,7 @@ class InvoiceController extends BaseController
});
if ($invoice->invitations->count() > 0) {
event(new InvoiceWasEmailed($invoice->invitations->first(), $invoice->company));
event(new InvoiceWasEmailed($invoice->invitations->first(), $invoice->company, Ninja::eventVars()));
}
if (!$bulk) {

View File

@ -15,6 +15,7 @@ use App\Events\Contact\ContactLoggedIn;
use App\Models\ClientContact;
use App\Models\CompanyToken;
use App\Models\User;
use App\Utils\Ninja;
use Closure;
class ContactTokenAuth
@ -53,7 +54,7 @@ class ContactTokenAuth
//stateless, don't remember the contact.
auth()->guard('contact')->login($client_contact, false);
event(new ContactLoggedIn($client_contact, $client_contact->company)); //todo
event(new ContactLoggedIn($client_contact, $client_contact->company, Ninja::eventVars())); //todo
} else {
$error = [
'message' => 'Invalid token',

View File

@ -14,6 +14,7 @@ namespace App\Http\Middleware;
use App\Events\User\UserLoggedIn;
use App\Models\CompanyToken;
use App\Models\User;
use App\Utils\Ninja;
use Closure;
class TokenAuth
@ -67,7 +68,7 @@ class TokenAuth
//stateless, don't remember the user.
auth()->login($user, false);
event(new UserLoggedIn($user, $company_token->company));
event(new UserLoggedIn($user, $company_token->company, Ninja::eventVars()));
} else {
$error = [
'message' => 'Invalid token',

View File

@ -72,7 +72,7 @@ class CreateAccount
$sp2d97e8 = CreateCompanyToken::dispatchNow($sp035a66, $spaa9f78, $spafe62e);
if ($spaa9f78) {
event(new AccountCreated($spaa9f78, $sp035a66));
event(new AccountCreated($spaa9f78, $sp035a66, Ninja::eventVars()));
}
$spaa9f78->fresh();

View File

@ -18,6 +18,7 @@ use App\Libraries\MultiDB;
use App\Mail\TemplateEmail;
use App\Models\Credit;
use App\Models\SystemLog;
use App\Utils\Ninja;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
@ -69,13 +70,13 @@ class EmailCredit implements ShouldQueue
->send(new TemplateEmail($message_array, $template_style, $invitation->contact->user, $invitation->contact->client));
if (count(Mail::failures()) > 0) {
event(new CreditWasEmailedAndFailed($this->credit, $this->credit->company, Mail::failures()));
event(new CreditWasEmailedAndFailed($this->credit, $this->credit->company, Mail::failures(), Ninja::eventVars()));
return $this->logMailError($errors);
}
//fire any events
event(new CreditWasEmailed($this->credit, $this->company));
event(new CreditWasEmailed($this->credit, $this->company, Ninja::eventVars()));
//sleep(5);
}

View File

@ -13,6 +13,7 @@ use App\Mail\TemplateEmail;
use App\Models\Company;
use App\Models\Payment;
use App\Models\SystemLog;
use App\Utils\Ninja;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
@ -57,13 +58,13 @@ class EmailPayment implements ShouldQueue
->send(new TemplateEmail($this->email_builder, $this->contact->user, $this->contact->customer));
if (count(Mail::failures()) > 0) {
event(new PaymentWasEmailedAndFailed($this->payment, Mail::failures()));
event(new PaymentWasEmailedAndFailed($this->payment, Mail::failures(), Ninja::eventVars()));
return $this->logMailError(Mail::failures());
}
//fire any events
event(new PaymentWasEmailed($this->payment));
event(new PaymentWasEmailed($this->payment, $this->payment->company, Ninja::eventVars()));
//sleep(5);
}

View File

@ -16,6 +16,7 @@ use App\DataMapper\DefaultSettings;
use App\Events\User\UserWasCreated;
use App\Models\CompanyUser;
use App\Models\User;
use App\Utils\Ninja;
use App\Utils\Traits\MakesHash;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Http\Request;
@ -77,7 +78,7 @@ class CreateUser
'settings' => null,
]);
event(new UserWasCreated($user, $this->company));
event(new UserWasCreated($user, $this->company, Ninja::eventVars()));
return $user;
}

View File

@ -18,6 +18,7 @@ use App\Libraries\MultiDB;
use App\Models\Account;
use App\Models\Invoice;
use App\Utils\ClientPortal\CustomMessage\invitation;
use App\Utils\Ninja;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
@ -74,7 +75,7 @@ class ReminderJob implements ShouldQueue
});
if ($invoice->invitations->count() > 0) {
event(new InvoiceWasEmailed($invoice->invitations->first(), $invoice->company));
event(new InvoiceWasEmailed($invoice->invitations->first(), $invoice->company, Ninja::eventVars()));
}
} else {

Some files were not shown because too many files have changed in this diff Show More