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\Product;
use App\Models\User; use App\Models\User;
use App\Repositories\InvoiceRepository; use App\Repositories\InvoiceRepository;
use App\Utils\Ninja;
use App\Utils\Traits\GeneratesCounter; use App\Utils\Traits\GeneratesCounter;
use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesHash;
use Carbon\Carbon; 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. //@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) private function createCredit($client)

View File

@ -12,6 +12,7 @@ use App\Models\Country;
use App\Models\Product; use App\Models\Product;
use App\Models\User; use App\Models\User;
use App\Repositories\InvoiceRepository; use App\Repositories\InvoiceRepository;
use App\Utils\Ninja;
use App\Utils\Traits\GeneratesCounter; use App\Utils\Traits\GeneratesCounter;
use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesHash;
use Carbon\Carbon; 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. //@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) private function createCredit($client)

View File

@ -22,6 +22,7 @@ use App\Models\Client;
use App\Models\Payment; use App\Models\Payment;
use App\Models\PaymentType; use App\Models\PaymentType;
use App\Models\Product; use App\Models\Product;
use App\Utils\Ninja;
use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesHash;
use Illuminate\Bus\Queueable; use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Contracts\Queue\ShouldQueue;
@ -92,7 +93,7 @@ class CreateTestCreditJob implements ShouldQueue
$credit->save(); $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\Payment;
use App\Models\PaymentType; use App\Models\PaymentType;
use App\Models\Product; use App\Models\Product;
use App\Utils\Ninja;
use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesHash;
use Illuminate\Bus\Queueable; use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Contracts\Queue\ShouldQueue;
@ -111,13 +112,13 @@ class CreateTestInvoiceJob implements ShouldQueue
$payment->invoices()->save($invoice); $payment->invoices()->save($invoice);
event(new PaymentWasCreated($payment, $payment->company)); event(new PaymentWasCreated($payment, $payment->company, Ninja::eventVars()));
$payment->service()->updateInvoicePayment(); $payment->service()->updateInvoicePayment();
//UpdateInvoicePayment::dispatchNow($payment, $payment->company); //UpdateInvoicePayment::dispatchNow($payment, $payment->company);
} }
//@todo this slow things down, but gives us PDFs of the invoices for inspection whilst debugging. //@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 $user;
public $company; public $company;
public $event_vars;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @return void * @return void
*/ */
public function __construct($user, $company) public function __construct($user, $company, $event_vars)
{ {
$this->user = $user; $this->user = $user;
$this->company = $company; $this->company = $company;
$this->event_vars = $event_vars;
} }
/** /**

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,4 +1,13 @@
<?php <?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; namespace App\Events\Company;
@ -11,7 +20,7 @@ use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable; use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
class CompanyWasDeleted class CompanyDocumentsDeleted
{ {
use Dispatchable, InteractsWithSockets, SerializesModels; use Dispatchable, InteractsWithSockets, SerializesModels;

View File

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

View File

@ -1,4 +1,14 @@
<?php <?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; namespace App\Events\Credit;
@ -16,14 +26,16 @@ class CreditWasCreated
public $company; public $company;
public $event_vars;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Credit $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->credit = $credit;
$this->company = $company; $this->company = $company;
$this->event_vars = $event_vars;
} }
} }

View File

@ -1,4 +1,13 @@
<?php <?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; namespace App\Events\Credit;
@ -15,14 +24,16 @@ class CreditWasEmailed
public $company; public $company;
public $event_vars;
/** /**
* Create a new event instance. * 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->credit = $credit;
$this->company = $company; $this->company = $company;
$this->event_vars = $event_vars;
} }
} }

View File

@ -1,4 +1,13 @@
<?php <?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; namespace App\Events\Credit;
@ -17,12 +26,16 @@ class CreditWasEmailedAndFailed
public $company; 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->credit = $credit;
$this->company = $company; $this->company = $company;
$this->errors = $errors; $this->errors = $errors;
$this->event_vars = $event_vars;
} }
} }

View File

@ -1,4 +1,14 @@
<?php <?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; namespace App\Events\Credit;
use App\Models\Company; use App\Models\Company;
@ -15,16 +25,19 @@ class CreditWasMarkedSent
* @var Credit * @var Credit
*/ */
public $credit; public $credit;
public $company; public $company;
public $event_vars;
/** /**
* Create a new event instance. * 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->credit = $credit;
$this->company = $company; $this->company = $company;
$this->event_vars = $event_vars;
} }
} }

View File

@ -1,4 +1,13 @@
<?php <?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; namespace App\Events\Credit;
@ -16,9 +25,16 @@ class CreditWasUpdated
public $company; 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->company = $company;
$this->event_vars = $event_vars;
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,8 +1,18 @@
<?php <?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; namespace App\Events\Payment\Methods;
use App\Models\ClientGatewayToken; use App\Models\ClientGatewayToken;
use App\Models\Company;
use Illuminate\Broadcasting\Channel; use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets; use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PresenceChannel; use Illuminate\Broadcasting\PresenceChannel;
@ -21,15 +31,18 @@ class MethodDeleted
private $payment_method; private $payment_method;
public $company; public $company;
public $event_vars;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param ClientGatewayToken $payment_method * @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->payment_method = $payment_method;
$this->company = $company; $this->company = $company;
$this->event_vars = $event_vars;
} }
/** /**

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -26,23 +26,24 @@ class PaymentWasEmailedAndFailed
*/ */
public $payment; public $payment;
/**
* @var array
*/
public $errors; public $errors;
public $company; public $company;
public $event_vars;
/** /**
* PaymentWasEmailedAndFailed constructor. * PaymentWasEmailedAndFailed constructor.
* @param Payment $payment * @param Payment $payment
* @param array $errors * @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->payment = $payment;
$this->errors = $errors; $this->errors = $errors;
$this->company = $company; $this->company = $company;
$this->event_vars = $event_vars;
} }
} }

View File

@ -11,6 +11,7 @@
namespace App\Events\Payment; namespace App\Events\Payment;
use App\Models\Company;
use App\Models\Payment; use App\Models\Payment;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
@ -29,16 +30,19 @@ class PaymentWasRefunded
public $refund_amount; public $refund_amount;
public $company; public $company;
public $event_vars;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Payment $payment * @param Payment $payment
* @param $refund_amount * @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->payment = $payment;
$this->refund_amount = $refund_amount; $this->refund_amount = $refund_amount;
$this->company = $company; $this->company = $company;
$this->event_vars = $event_vars;
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,17 @@
<?php <?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; namespace App\Events\Quote;
use App\Models\Company;
use App\Models\Quote; use App\Models\Quote;
use Illuminate\Broadcasting\Channel; use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets; use Illuminate\Broadcasting\InteractsWithSockets;
@ -18,14 +28,17 @@ class QuoteWasApproved
public $quote; public $quote;
public $company; public $company;
public $event_vars;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @return void * @return void
*/ */
public function __construct(Quote $quote, $company) public function __construct(Quote $quote, Company $company, array $event_vars)
{ {
$this->quote = $quote; $this->quote = $quote;
$this->company = $company; $this->company = $company;
$this->event_vars = $event_vars;
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,4 +1,14 @@
<?php <?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; namespace App\Events\Quote;
use App\Models\Company; use App\Models\Company;
@ -11,21 +21,21 @@ use Illuminate\Queue\SerializesModels;
class QuoteWasMarkedApproved class QuoteWasMarkedApproved
{ {
use SerializesModels; use SerializesModels;
/**
* @var Quote
*/
public $quote; public $quote;
public $company; public $company;
public $event_vars;
/** /**
* QuoteWasMarkedApproved constructor. * Create a new event instance.
* @param Quote $quote *
* @param Company $company * @return void
*/ */
public function __construct(Quote $quote, Company $company) public function __construct(Quote $quote, Company $company, array $event_vars)
{ {
$this->quote = $quote; $this->quote = $quote;
$this->company = $company; $this->company = $company;
$this->event_vars = $event_vars;
} }
} }

View File

@ -1,4 +1,14 @@
<?php <?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; namespace App\Events\Quote;
use App\Models\Company; use App\Models\Company;
@ -11,20 +21,21 @@ use Illuminate\Queue\SerializesModels;
class QuoteWasMarkedSent class QuoteWasMarkedSent
{ {
use SerializesModels; use SerializesModels;
/**
* @var Invoice
*/
public $quote; public $quote;
public $company; public $company;
public $event_vars;
/** /**
* Create a new event instance. * 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->quote = $quote;
$this->company = $company; $this->company = $company;
$this->event_vars = $event_vars;
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -11,6 +11,7 @@
namespace App\Events\Vendor; namespace App\Events\Vendor;
use App\Models\Company;
use App\Models\Vendor; use App\Models\Vendor;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
@ -27,14 +28,17 @@ class VendorWasUpdated
public $vendor; public $vendor;
public $company; public $company;
public $event_vars;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Vendor $vendor * @param Vendor $vendor
*/ */
public function __construct(Vendor $vendor, $company) public function __construct(Vendor $vendor, Company $company, array $event_vars)
{ {
$this->vendor = $vendor; $this->vendor = $vendor;
$this->company = $company; $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\Events\Contact\ContactLoggedIn;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Models\ClientContact; use App\Models\ClientContact;
use App\Utils\Ninja;
use Auth; use Auth;
use Illuminate\Foundation\Auth\AuthenticatesUsers; use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Http\Request; use Illuminate\Http\Request;
@ -63,7 +64,7 @@ class ContactLoginController extends Controller
{ {
Auth::guard('contact')->login($client, true); 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')) { if (session()->get('url.intended')) {
return redirect(session()->get('url.intended')); return redirect(session()->get('url.intended'));

View File

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

View File

@ -14,6 +14,7 @@ namespace App\Http\Controllers\ClientPortal;
use App\Events\Misc\InvitationWasViewed; use App\Events\Misc\InvitationWasViewed;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Models\InvoiceInvitation; use App\Models\InvoiceInvitation;
use App\Utils\Ninja;
use App\Utils\Traits\MakesDates; use App\Utils\Traits\MakesDates;
use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesHash;
use Illuminate\Http\Request; use Illuminate\Http\Request;
@ -47,7 +48,7 @@ class InvitationController extends Controller
if (!request()->has('silent')) { if (!request()->has('silent')) {
$invitation->markViewed(); $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})]); 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\CompanyGateway;
use App\Models\GatewayType; use App\Models\GatewayType;
use App\PaymentDrivers\AuthorizePaymentDriver; use App\PaymentDrivers\AuthorizePaymentDriver;
use App\Utils\Ninja;
use App\Utils\Traits\MakesDates; use App\Utils\Traits\MakesDates;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
@ -135,7 +136,7 @@ class PaymentMethodController extends Controller
public function destroy(ClientGatewayToken $payment_method) public function destroy(ClientGatewayToken $payment_method)
{ {
try { try {
event(new MethodDeleted($payment_method, auth('contact')->user()->company)); event(new MethodDeleted($payment_method, auth('contact')->user()->company, Ninja::eventVars()));
$payment_method->delete(); $payment_method->delete();
} catch (\Exception $e) { } catch (\Exception $e) {
Log::error(json_encode($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\Http\Requests\ClientPortal\ShowQuoteRequest;
use App\Models\Company; use App\Models\Company;
use App\Models\Quote; use App\Models\Quote;
use App\Utils\Ninja;
use App\Utils\TempFile; use App\Utils\TempFile;
use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesHash;
use ZipStream\Option\Archive; use ZipStream\Option\Archive;
@ -108,7 +109,7 @@ class QuoteController extends Controller
if ($process) { if ($process) {
foreach ($quotes as $quote) { foreach ($quotes as $quote) {
$quote->service()->approve()->save(); $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.'); return route('client.quotes.index')->withSuccess('Quote(s) approved successfully.');

View File

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

View File

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

View File

@ -36,6 +36,7 @@ use App\Models\Invoice;
use App\Models\InvoiceInvitation; use App\Models\InvoiceInvitation;
use App\Repositories\InvoiceRepository; use App\Repositories\InvoiceRepository;
use App\Transformers\InvoiceTransformer; use App\Transformers\InvoiceTransformer;
use App\Utils\Ninja;
use App\Utils\TempFile; use App\Utils\TempFile;
use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesHash;
use Illuminate\Http\Request; 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)); $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(); $invoice = $invoice->service()->triggeredActions($request)->save();
@ -393,7 +394,7 @@ class InvoiceController extends BaseController
$invoice = $this->invoice_repo->save($request->all(), $invoice); $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); return $this->itemResponse($invoice);
} }
@ -718,7 +719,7 @@ class InvoiceController extends BaseController
}); });
if ($invoice->invitations->count() > 0) { 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) { if (!$bulk) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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