diff --git a/app/Events/Account/AccountCreated.php b/app/Events/Account/AccountCreated.php index e641c04ccb8c..463050f8d2f3 100644 --- a/app/Events/Account/AccountCreated.php +++ b/app/Events/Account/AccountCreated.php @@ -32,14 +32,16 @@ class AccountCreated */ public $user; + public $company; /** * Create a new event instance. * * @return void */ - public function __construct($user) + public function __construct($user, $company) { $this->user = $user; + $this->company = $company; } /** diff --git a/app/Events/Client/ClientWasArchived.php b/app/Events/Client/ClientWasArchived.php index 83430c3d72a0..550b7516ea48 100644 --- a/app/Events/Client/ClientWasArchived.php +++ b/app/Events/Client/ClientWasArchived.php @@ -12,13 +12,14 @@ namespace App\Events\Client; use App\Models\Client; +use App\Models\Company; 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 ClientWasArchived. @@ -32,14 +33,16 @@ class ClientWasArchived */ public $client; + public $company; /** * Create a new event instance. * * @param Client $client */ - public function __construct(Client $client) + public function __construct(Client $client, Company $company) { $this->client = $client; + $this->company = $company; } /** diff --git a/app/Events/Client/ClientWasCreated.php b/app/Events/Client/ClientWasCreated.php index 94c7e6c3b7c3..aa78706de19c 100644 --- a/app/Events/Client/ClientWasCreated.php +++ b/app/Events/Client/ClientWasCreated.php @@ -26,13 +26,15 @@ class ClientWasCreated */ public $client; + public $company; /** * Create a new event instance. * * @param Client $client */ - public function __construct(Client $client) + public function __construct(Client $client, Company $company) { $this->client = $client; + $this->company = $company; } } diff --git a/app/Events/Client/ClientWasDeleted.php b/app/Events/Client/ClientWasDeleted.php index 1766ed586299..e788f7ace92f 100644 --- a/app/Events/Client/ClientWasDeleted.php +++ b/app/Events/Client/ClientWasDeleted.php @@ -26,13 +26,15 @@ class ClientWasDeleted */ public $client; + public $company; /** * Create a new event instance. * * @param Client $client */ - public function __construct(Client $client) + public function __construct(Client $client, Company $company) { $this->client = $client; + $this->company = $company; } } diff --git a/app/Events/Client/ClientWasRestored.php b/app/Events/Client/ClientWasRestored.php index 464e6045e1df..81a3d1a14e67 100644 --- a/app/Events/Client/ClientWasRestored.php +++ b/app/Events/Client/ClientWasRestored.php @@ -26,13 +26,15 @@ class ClientWasRestored */ public $client; + public $company; /** * Create a new event instance. * * @param Client $client */ - public function __construct(Client $client) + public function __construct(Client $client, Company $company) { $this->client = $client; + $this->company = $company; } } diff --git a/app/Events/Client/ClientWasUpdated.php b/app/Events/Client/ClientWasUpdated.php index 0dbd33c813e8..e761a7148ab4 100644 --- a/app/Events/Client/ClientWasUpdated.php +++ b/app/Events/Client/ClientWasUpdated.php @@ -26,13 +26,15 @@ class ClientWasUpdated */ public $client; + public $company; /** * Create a new event instance. * * @param Client $client */ - public function __construct(Client $client) + public function __construct(Client $client, Company $company) { $this->client = $client; + $this->company = $company; } } diff --git a/app/Events/CompanyToken/CompanyTokenWasDeleted.php b/app/Events/CompanyToken/CompanyTokenWasDeleted.php deleted file mode 100644 index c6e914951841..000000000000 --- a/app/Events/CompanyToken/CompanyTokenWasDeleted.php +++ /dev/null @@ -1,42 +0,0 @@ -company_token = $company_token; - } - - /** - * Get the channels the event should broadcast on. - * - * @return \Illuminate\Broadcasting\Channel|array - */ - public function broadcastOn() - { - return new PrivateChannel('channel-name'); - } -} diff --git a/app/Events/Contact/ContactLoggedIn.php b/app/Events/Contact/ContactLoggedIn.php index 4f7a7626a312..447dd2c31ccb 100644 --- a/app/Events/Contact/ContactLoggedIn.php +++ b/app/Events/Contact/ContactLoggedIn.php @@ -33,14 +33,17 @@ class ContactLoggedIn */ public $client_contact; + public $company; + /** * Create a new event instance. * * @return void */ - public function __construct(ClientContact $client_contact) + public function __construct(ClientContact $client_contact, $company) { $this->client_contact = $client_contact; + $this->company = $company; } /** diff --git a/app/Events/Credit/CreditWasEmailed.php b/app/Events/Credit/CreditWasEmailed.php index 377226a48d24..0cddca9deefc 100644 --- a/app/Events/Credit/CreditWasEmailed.php +++ b/app/Events/Credit/CreditWasEmailed.php @@ -13,13 +13,16 @@ class CreditWasEmailed public $credit; + public $company; + /** * Create a new event instance. * * @return void */ - public function __construct(Credit $credit) + public function __construct(Credit $credit, $company) { $this->credit = $credit; + $this->company = $company; } } diff --git a/app/Events/Credit/CreditWasEmailedAndFailed.php b/app/Events/Credit/CreditWasEmailedAndFailed.php index 66ba51a78617..a780282a5752 100644 --- a/app/Events/Credit/CreditWasEmailedAndFailed.php +++ b/app/Events/Credit/CreditWasEmailedAndFailed.php @@ -15,10 +15,14 @@ class CreditWasEmailedAndFailed public $errors; - public function __construct(Credit $credit, array $errors) + public $company; + + public function __construct(Credit $credit, $company, array $errors) { $this->credit = $credit; + $this->company = $company; + $this->errors = $errors; } } diff --git a/app/Events/Design/DesignWasArchived.php b/app/Events/Design/DesignWasArchived.php index c41303db150d..8207d1671a84 100644 --- a/app/Events/Design/DesignWasArchived.php +++ b/app/Events/Design/DesignWasArchived.php @@ -32,14 +32,17 @@ class DesignWasArchived */ public $design; + public $company; /** * Create a new event instance. * * @param Design $design */ - public function __construct(Design $design) + public function __construct(Design $design, $company) { $this->design = $design; + + $this->company = $company; } /** diff --git a/app/Events/Design/DesignWasCreated.php b/app/Events/Design/DesignWasCreated.php index 6ed1669144ce..9e2b0bed6998 100644 --- a/app/Events/Design/DesignWasCreated.php +++ b/app/Events/Design/DesignWasCreated.php @@ -26,14 +26,17 @@ class DesignWasCreated */ public $design; + public $company; /** * Create a new event instance. * * @param Design $design */ - public function __construct(Design $design) + public function __construct(Design $design, $company) { $this->design = $design; + + $this->company = $company; } /** diff --git a/app/Events/Design/DesignWasDeleted.php b/app/Events/Design/DesignWasDeleted.php index 93602e8248ff..7944333d4bf7 100644 --- a/app/Events/Design/DesignWasDeleted.php +++ b/app/Events/Design/DesignWasDeleted.php @@ -26,14 +26,17 @@ class DesignWasDeleted */ public $design; + public $company; /** * Create a new event instance. * * @param Design $design */ - public function __construct(Design $design) + public function __construct(Design $design, $company) { $this->design = $design; + + $this->company = $company; } /** diff --git a/app/Events/Design/DesignWasRestored.php b/app/Events/Design/DesignWasRestored.php index c9f66c882319..3de5053c3b8c 100644 --- a/app/Events/Design/DesignWasRestored.php +++ b/app/Events/Design/DesignWasRestored.php @@ -26,14 +26,17 @@ class DesignWasRestored */ public $design; + public $company; /** * Create a new event instance. * * @param Design $design */ - public function __construct(Design $design) + public function __construct(Design $design, $company) { $this->design = $design; + + $this->company = $company; } /** diff --git a/app/Events/Design/DesignWasUpdated.php b/app/Events/Design/DesignWasUpdated.php index 04c7c6b62ed8..25bd8f164833 100644 --- a/app/Events/Design/DesignWasUpdated.php +++ b/app/Events/Design/DesignWasUpdated.php @@ -26,14 +26,17 @@ class DesignWasUpdated */ public $design; + public $company; /** * Create a new event instance. * * @param Design $design */ - public function __construct(Design $design) + public function __construct(Design $design, $company) { $this->design = $design; + + $this->company = $company; } /** diff --git a/app/Events/Document/DocumentWasArchived.php b/app/Events/Document/DocumentWasArchived.php index e613e6a40175..70cb9d524750 100644 --- a/app/Events/Document/DocumentWasArchived.php +++ b/app/Events/Document/DocumentWasArchived.php @@ -32,14 +32,16 @@ class DocumentWasArchived */ public $document; + public $company; /** * Create a new event instance. * * @param Document $document */ - public function __construct(Document $document) + public function __construct(Document $document, $company) { $this->document = $document; + $this->company = $company; } /** diff --git a/app/Events/Document/DocumentWasCreated.php b/app/Events/Document/DocumentWasCreated.php index 442f7a7b49eb..caf45ac264f1 100644 --- a/app/Events/Document/DocumentWasCreated.php +++ b/app/Events/Document/DocumentWasCreated.php @@ -26,13 +26,15 @@ class DocumentWasCreated */ public $document; + public $company; /** * Create a new event instance. * * @param Document $document */ - public function __construct(Document $document) + public function __construct(Document $document, $company) { $this->document = $document; + $this->company = $company; } } diff --git a/app/Events/Document/DocumentWasDeleted.php b/app/Events/Document/DocumentWasDeleted.php index 92d0856e9943..3d0f9f4357a1 100644 --- a/app/Events/Document/DocumentWasDeleted.php +++ b/app/Events/Document/DocumentWasDeleted.php @@ -26,13 +26,15 @@ class DocumentWasDeleted */ public $document; + public $company; /** * Create a new event instance. * * @param Document $document */ - public function __construct(Document $document) + public function __construct(Document $document, $company) { $this->document = $document; + $this->company = $company; } } diff --git a/app/Events/Document/DocumentWasRestored.php b/app/Events/Document/DocumentWasRestored.php index 4e6cd6aebc11..ab138a647857 100644 --- a/app/Events/Document/DocumentWasRestored.php +++ b/app/Events/Document/DocumentWasRestored.php @@ -26,13 +26,15 @@ class DocumentWasRestored */ public $document; + public $company; /** * Create a new event instance. * * @param Document $document */ - public function __construct(Document $document) + public function __construct(Document $document, $company) { $this->document = $document; + $this->company = $company; } } diff --git a/app/Events/Document/DocumentWasUpdated.php b/app/Events/Document/DocumentWasUpdated.php index 12c10d55feb8..1797b61353bf 100644 --- a/app/Events/Document/DocumentWasUpdated.php +++ b/app/Events/Document/DocumentWasUpdated.php @@ -26,13 +26,15 @@ class DocumentWasUpdated */ public $document; + public $company; /** * Create a new event instance. * * @param Document $document */ - public function __construct(Document $document) + public function __construct(Document $document, $company) { $this->document = $document; + $this->company = $company; } } diff --git a/app/Events/Expense/ExpenseWasArchived.php b/app/Events/Expense/ExpenseWasArchived.php index 803bf8494c80..195daa295a4c 100644 --- a/app/Events/Expense/ExpenseWasArchived.php +++ b/app/Events/Expense/ExpenseWasArchived.php @@ -26,13 +26,15 @@ class ExpenseWasArchived */ public $expense; + public $company; /** * Create a new event instance. * * @param Expense $expense */ - public function __construct(Expense $expense) + public function __construct(Expense $expense, $company) { $this->expense = $expense; + $this->company = $company; } } diff --git a/app/Events/Expense/ExpenseWasCreated.php b/app/Events/Expense/ExpenseWasCreated.php index f689e198c434..5cb4351deaa2 100644 --- a/app/Events/Expense/ExpenseWasCreated.php +++ b/app/Events/Expense/ExpenseWasCreated.php @@ -26,13 +26,15 @@ class ExpenseWasCreated */ public $expense; + public $company; /** * Create a new event instance. * * @param Expense $expense */ - public function __construct(Expense $expense) + public function __construct(Expense $expense, $company) { $this->expense = $expense; + $this->company = $company; } } diff --git a/app/Events/Expense/ExpenseWasDeleted.php b/app/Events/Expense/ExpenseWasDeleted.php index 429419762e5d..d79d78498d90 100644 --- a/app/Events/Expense/ExpenseWasDeleted.php +++ b/app/Events/Expense/ExpenseWasDeleted.php @@ -26,13 +26,15 @@ class ExpenseWasDeleted */ public $expense; + public $company; /** * Create a new event instance. * * @param Expense $expense */ - public function __construct(Expense $expense) + public function __construct(Expense $expense, $company) { $this->expense = $expense; + $this->company = $company; } } diff --git a/app/Events/Expense/ExpenseWasRestored.php b/app/Events/Expense/ExpenseWasRestored.php index f7e455010704..84f8843ae48b 100644 --- a/app/Events/Expense/ExpenseWasRestored.php +++ b/app/Events/Expense/ExpenseWasRestored.php @@ -26,13 +26,15 @@ class ExpenseWasRestored */ public $expense; + public $company; /** * Create a new event instance. * * @param Expense $expense */ - public function __construct(Expense $expense) + public function __construct(Expense $expense, $company) { $this->expense = $expense; + $this->company = $company; } } diff --git a/app/Events/Expense/ExpenseWasUpdated.php b/app/Events/Expense/ExpenseWasUpdated.php index 3d4bbec8b925..6a1029b7266a 100644 --- a/app/Events/Expense/ExpenseWasUpdated.php +++ b/app/Events/Expense/ExpenseWasUpdated.php @@ -26,13 +26,15 @@ class ExpenseWasUpdated */ public $expense; + public $company; /** * Create a new event instance. * * @param Expense $expense */ - public function __construct(Expense $expense) + public function __construct(Expense $expense, $company) { $this->expense = $expense; + $this->company = $company; } } diff --git a/app/Events/Invoice/InvoiceWasArchived.php b/app/Events/Invoice/InvoiceWasArchived.php index aff1242358c7..7b59934ff42d 100644 --- a/app/Events/Invoice/InvoiceWasArchived.php +++ b/app/Events/Invoice/InvoiceWasArchived.php @@ -26,13 +26,15 @@ class InvoiceWasArchived */ public $invoice; + public $company; /** * Create a new event instance. * * @param Invoice $invoice */ - public function __construct(Invoice $invoice) + public function __construct(Invoice $invoice, $company) { $this->invoice = $invoice; + $this->company = $company; } } diff --git a/app/Events/Invoice/InvoiceWasCancelled.php b/app/Events/Invoice/InvoiceWasCancelled.php index 399738515c58..b6ce0f72db87 100644 --- a/app/Events/Invoice/InvoiceWasCancelled.php +++ b/app/Events/Invoice/InvoiceWasCancelled.php @@ -26,13 +26,15 @@ class InvoiceWasCancelled */ public $invoice; + public $company; /** * Create a new event instance. * * @param Invoice $invoice */ - public function __construct(Invoice $invoice) + public function __construct(Invoice $invoice, $company) { $this->invoice = $invoice; + $this->company = $company; } } diff --git a/app/Events/Invoice/InvoiceWasDeleted.php b/app/Events/Invoice/InvoiceWasDeleted.php index 12575aa0603f..3515d916e2f5 100644 --- a/app/Events/Invoice/InvoiceWasDeleted.php +++ b/app/Events/Invoice/InvoiceWasDeleted.php @@ -26,13 +26,15 @@ class InvoiceWasDeleted */ public $invoice; + public $company; /** * Create a new event instance. * * @param Invoice $invoice */ - public function __construct(Invoice $invoice) + public function __construct(Invoice $invoice, $company) { $this->invoice = $invoice; + $this->company = $company; } } diff --git a/app/Events/Invoice/InvoiceWasEmailed.php b/app/Events/Invoice/InvoiceWasEmailed.php index 4263c2864508..8e31ccfe7a79 100644 --- a/app/Events/Invoice/InvoiceWasEmailed.php +++ b/app/Events/Invoice/InvoiceWasEmailed.php @@ -26,13 +26,15 @@ class InvoiceWasEmailed */ public $invitation; + public $company; /** * Create a new event instance. * * @param Invoice $invoice */ - public function __construct(InvoiceInvitation $invitation) + public function __construct(InvoiceInvitation $invitation, $company) { $this->invitation = $invitation; + $this->company = $company; } } diff --git a/app/Events/Invoice/InvoiceWasEmailedAndFailed.php b/app/Events/Invoice/InvoiceWasEmailedAndFailed.php index b9f0e34f76b0..26a909914008 100644 --- a/app/Events/Invoice/InvoiceWasEmailedAndFailed.php +++ b/app/Events/Invoice/InvoiceWasEmailedAndFailed.php @@ -31,15 +31,19 @@ class InvoiceWasEmailedAndFailed */ public $errors; + + public $company; /** * Create a new event instance. * * @param Invoice $invoice */ - public function __construct(Invoice $invoice, array $errors) + public function __construct(Invoice $invoice, $company, array $errors) { $this->invoice = $invoice; + $this->company = $company; + $this->errors = $errors; } } diff --git a/app/Events/Invoice/InvoiceWasRestored.php b/app/Events/Invoice/InvoiceWasRestored.php index 56c16f06eb29..bd0592a932df 100644 --- a/app/Events/Invoice/InvoiceWasRestored.php +++ b/app/Events/Invoice/InvoiceWasRestored.php @@ -28,15 +28,17 @@ class InvoiceWasRestored public $fromDeleted; + public $company; /** * Create a new event instance. * * @param Invoice $invoice * @param $fromDeleted */ - public function __construct(Invoice $invoice, $fromDeleted) + public function __construct(Invoice $invoice, $fromDeleted, $company) { $this->invoice = $invoice; $this->fromDeleted = $fromDeleted; + $this->company = $company; } } diff --git a/app/Events/Invoice/InvoiceWasReversed.php b/app/Events/Invoice/InvoiceWasReversed.php index c23510014995..3e76f334bc49 100644 --- a/app/Events/Invoice/InvoiceWasReversed.php +++ b/app/Events/Invoice/InvoiceWasReversed.php @@ -26,13 +26,15 @@ class InvoiceWasReversed */ public $invoice; + public $company; /** * Create a new event instance. * * @param Invoice $invoice */ - public function __construct(Invoice $invoice) + public function __construct(Invoice $invoice, $company) { $this->invoice = $invoice; + $this->company = $company; } } diff --git a/app/Events/Misc/InvitationWasViewed.php b/app/Events/Misc/InvitationWasViewed.php index 0f5a5463affe..25b8dffe15be 100644 --- a/app/Events/Misc/InvitationWasViewed.php +++ b/app/Events/Misc/InvitationWasViewed.php @@ -27,14 +27,17 @@ class InvitationWasViewed public $invitation; public $entity; + + public $company; /** * Create a new event instance. * * @param Invoice $invoice */ - public function __construct($entity, $invitation) + public function __construct($entity, $invitation, $company) { $this->entity = $entity; $this->invitation = $invitation; + $this->company = $company; } } diff --git a/app/Events/Payment/Methods/MethodDeleted.php b/app/Events/Payment/Methods/MethodDeleted.php index b0dd9cce95cd..508f1d86be82 100644 --- a/app/Events/Payment/Methods/MethodDeleted.php +++ b/app/Events/Payment/Methods/MethodDeleted.php @@ -20,14 +20,16 @@ class MethodDeleted */ private $payment_method; + public $company; /** * Create a new event instance. * * @param ClientGatewayToken $payment_method */ - public function __construct(ClientGatewayToken $payment_method) + public function __construct(ClientGatewayToken $payment_method, $company) { $this->payment_method = $payment_method; + $this->company = $company; } /** diff --git a/app/Events/Payment/PaymentCompleted.php b/app/Events/Payment/PaymentCompleted.php index d94fc13e9ea0..6476dc2919d3 100644 --- a/app/Events/Payment/PaymentCompleted.php +++ b/app/Events/Payment/PaymentCompleted.php @@ -26,13 +26,15 @@ class PaymentCompleted */ public $payment; + public $company /** * Create a new event instance. * * @param Payment $payment */ - public function __construct(Payment $payment) + public function __construct(Payment $payment, $company) { $this->payment = $payment; + $this->company = $company; } } diff --git a/app/Events/Payment/PaymentFailed.php b/app/Events/Payment/PaymentFailed.php index e7575b6f426a..f39b7ce953f8 100644 --- a/app/Events/Payment/PaymentFailed.php +++ b/app/Events/Payment/PaymentFailed.php @@ -26,13 +26,15 @@ class PaymentFailed */ public $payment; + public $company /** * Create a new event instance. * * @param Payment $payment */ - public function __construct(Payment $payment) + public function __construct(Payment $payment, $company) { $this->payment = $payment; + $this->company = $company; } } diff --git a/app/Events/Payment/PaymentWasArchived.php b/app/Events/Payment/PaymentWasArchived.php index 64e527cb273b..3b05d9ea8e60 100644 --- a/app/Events/Payment/PaymentWasArchived.php +++ b/app/Events/Payment/PaymentWasArchived.php @@ -26,13 +26,15 @@ class PaymentWasArchived */ public $payment; + public $company /** * Create a new event instance. * * @param Payment $payment */ - public function __construct(Payment $payment) + public function __construct(Payment $payment, $company) { $this->payment = $payment; + $this->company = $company; } } diff --git a/app/Events/Payment/PaymentWasDeleted.php b/app/Events/Payment/PaymentWasDeleted.php index 3315de999eb6..0fdb7f228bb6 100644 --- a/app/Events/Payment/PaymentWasDeleted.php +++ b/app/Events/Payment/PaymentWasDeleted.php @@ -26,13 +26,15 @@ class PaymentWasDeleted */ public $payment; + public $company /** * Create a new event instance. * * @param Payment $payment */ - public function __construct(Payment $payment) + public function __construct(Payment $payment, $company) { $this->payment = $payment; + $this->company = $company; } } diff --git a/app/Events/Payment/PaymentWasEmailed.php b/app/Events/Payment/PaymentWasEmailed.php index d828b105e91e..9f165d206052 100644 --- a/app/Events/Payment/PaymentWasEmailed.php +++ b/app/Events/Payment/PaymentWasEmailed.php @@ -26,12 +26,15 @@ class PaymentWasEmailed */ public $payment; + public $company /** - * PaymentWasEmailed constructor. + * Create a new event instance. + * * @param Payment $payment */ - public function __construct(Payment $payment) + public function __construct(Payment $payment, $company) { $this->payment = $payment; + $this->company = $company; } } diff --git a/app/Events/Payment/PaymentWasEmailedAndFailed.php b/app/Events/Payment/PaymentWasEmailedAndFailed.php index 5a56119fa956..c4059cec2de8 100644 --- a/app/Events/Payment/PaymentWasEmailedAndFailed.php +++ b/app/Events/Payment/PaymentWasEmailedAndFailed.php @@ -31,15 +31,18 @@ class PaymentWasEmailedAndFailed */ public $errors; + public $company; /** * PaymentWasEmailedAndFailed constructor. * @param Payment $payment * @param array $errors */ - public function __construct(Payment $payment, array $errors) + public function __construct(Payment $payment, $company, array $errors) { $this->payment = $payment; $this->errors = $errors; + + $this->company = $company; } } diff --git a/app/Events/Payment/PaymentWasRefunded.php b/app/Events/Payment/PaymentWasRefunded.php index 5bf2dbfa624a..eed020b5ee38 100644 --- a/app/Events/Payment/PaymentWasRefunded.php +++ b/app/Events/Payment/PaymentWasRefunded.php @@ -28,15 +28,17 @@ class PaymentWasRefunded public $refund_amount; + public $company; /** * Create a new event instance. * * @param Payment $payment * @param $refund_amount */ - public function __construct(Payment $payment, $refund_amount) + public function __construct(Payment $payment, $refund_amount, $company) { $this->payment = $payment; $this->refund_amount = $refund_amount; + $this->company = $company; } } diff --git a/app/Events/Payment/PaymentWasRestored.php b/app/Events/Payment/PaymentWasRestored.php index caf993c55609..5a20d46ea50b 100644 --- a/app/Events/Payment/PaymentWasRestored.php +++ b/app/Events/Payment/PaymentWasRestored.php @@ -26,16 +26,17 @@ class PaymentWasRestored */ public $payment; public $fromDeleted; - + public $company; /** * Create a new event instance. * * @param Payment $payment * @param $fromDeleted */ - public function __construct(Payment $payment, $fromDeleted) + public function __construct(Payment $payment, $fromDeleted, $company) { $this->payment = $payment; $this->fromDeleted = $fromDeleted; + $this->company = $company; } } diff --git a/app/Events/Payment/PaymentWasVoided.php b/app/Events/Payment/PaymentWasVoided.php index a718253e2bc0..555f30c8d9e4 100644 --- a/app/Events/Payment/PaymentWasVoided.php +++ b/app/Events/Payment/PaymentWasVoided.php @@ -26,13 +26,15 @@ class PaymentWasVoided */ public $payment; + public $company /** * Create a new event instance. * * @param Payment $payment */ - public function __construct(Payment $payment) + public function __construct(Payment $payment, $company) { $this->payment = $payment; + $this->company = $company; } } diff --git a/app/Events/Product/ProductWasCreated.php b/app/Events/Product/ProductWasCreated.php index 07b1fcf113a4..54cea9bd9903 100644 --- a/app/Events/Product/ProductWasCreated.php +++ b/app/Events/Product/ProductWasCreated.php @@ -28,14 +28,17 @@ class ProductWasCreated **/ public $input; + public $company; + /** * Create a new event instance. * * @return void */ - public function __construct(Product $product, $input = null) + public function __construct(Product $product, $input = null, $company) { $this->product = $product; $this->input = $input; + $this->company = $company; } } diff --git a/app/Events/Product/ProductWasDeleted.php b/app/Events/Product/ProductWasDeleted.php index 3c4dae126363..8ae67cefe06d 100644 --- a/app/Events/Product/ProductWasDeleted.php +++ b/app/Events/Product/ProductWasDeleted.php @@ -23,13 +23,15 @@ class ProductWasDeleted */ public $product; + public $company; /** * Create a new event instance. * * @return void */ - public function __construct(Product $product) + public function __construct(Product $product, $company) { $this->product = $product; + $this->company = $company; } } diff --git a/app/Events/Product/ProductWasUpdated.php b/app/Events/Product/ProductWasUpdated.php index 2aa27106aeb7..4473bf801400 100644 --- a/app/Events/Product/ProductWasUpdated.php +++ b/app/Events/Product/ProductWasUpdated.php @@ -28,14 +28,17 @@ class ProductWasUpdated **/ public $input; + public $company; + /** * Create a new event instance. * * @return void */ - public function __construct(Product $product, $input = null) + public function __construct(Product $product, $input = null, $company) { $this->product = $product; $this->input = $input; + $this->company = $company; } } diff --git a/app/Events/Quote/QuoteWasApproved.php b/app/Events/Quote/QuoteWasApproved.php index 421911d2ddab..a879db7c3cbc 100644 --- a/app/Events/Quote/QuoteWasApproved.php +++ b/app/Events/Quote/QuoteWasApproved.php @@ -17,13 +17,15 @@ class QuoteWasApproved public $quote; + public $company; /** * Create a new event instance. * * @return void */ - public function __construct(Quote $quote) + public function __construct(Quote $quote, $company) { $this->quote = $quote; + $this->company = $company; } } diff --git a/app/Events/Quote/QuoteWasArchived.php b/app/Events/Quote/QuoteWasArchived.php index 3a1b2745a7e1..7dd633434854 100644 --- a/app/Events/Quote/QuoteWasArchived.php +++ b/app/Events/Quote/QuoteWasArchived.php @@ -18,14 +18,15 @@ class QuoteWasArchived use SerializesModels; public $quote; - + public $company; /** * Create a new event instance. * - * @param $quote + * @return void */ - public function __construct($quote) + public function __construct(Quote $quote, $company) { $this->quote = $quote; + $this->company = $company; } } diff --git a/app/Events/Quote/QuoteWasCreated.php b/app/Events/Quote/QuoteWasCreated.php index 94cfb2ffc8e0..4d9ac9d11d74 100644 --- a/app/Events/Quote/QuoteWasCreated.php +++ b/app/Events/Quote/QuoteWasCreated.php @@ -19,15 +19,17 @@ use Illuminate\Queue\SerializesModels; class QuoteWasCreated { use SerializesModels; + public $quote; - + public $company; /** * Create a new event instance. * - * @param $quote + * @return void */ - public function __construct($quote) + public function __construct(Quote $quote, $company) { $this->quote = $quote; + $this->company = $company; } } diff --git a/app/Events/Quote/QuoteWasDeleted.php b/app/Events/Quote/QuoteWasDeleted.php index c037180a7cc5..06cb17a247ec 100644 --- a/app/Events/Quote/QuoteWasDeleted.php +++ b/app/Events/Quote/QuoteWasDeleted.php @@ -21,13 +21,15 @@ class QuoteWasDeleted use SerializesModels; public $quote; + public $company; /** * Create a new event instance. * - * @param $quote + * @return void */ - public function __construct($quote) + public function __construct(Quote $quote, $company) { $this->quote = $quote; + $this->company = $company; } } diff --git a/app/Events/Quote/QuoteWasEmailed.php b/app/Events/Quote/QuoteWasEmailed.php index db0bd4c08f06..3c1895c65434 100644 --- a/app/Events/Quote/QuoteWasEmailed.php +++ b/app/Events/Quote/QuoteWasEmailed.php @@ -19,8 +19,11 @@ use Illuminate\Queue\SerializesModels; class QuoteWasEmailed { use SerializesModels; + public $quote; + public $company; + /** * @var string */ @@ -31,9 +34,11 @@ class QuoteWasEmailed * * @param $quote */ - public function __construct($quote, $notes) + public function __construct($quote, $notes, $company) { $this->quote = $quote; $this->notes = $notes; + $this->company = $company; } + } diff --git a/app/Events/Quote/QuoteWasEmailedAndFailed.php b/app/Events/Quote/QuoteWasEmailedAndFailed.php index 97075e678692..a6326f90c847 100644 --- a/app/Events/Quote/QuoteWasEmailedAndFailed.php +++ b/app/Events/Quote/QuoteWasEmailedAndFailed.php @@ -26,6 +26,8 @@ class QuoteWasEmailedAndFailed */ public $quote; + public $company; + /** * @var array */ @@ -36,10 +38,12 @@ class QuoteWasEmailedAndFailed * @param Quote $quote * @param array $errors */ - public function __construct(Quote $quote, array $errors) + public function __construct(Quote $quote, array $errors, $company) { $this->quote = $quote; $this->errors = $errors; + + $this->company = $company; } } diff --git a/app/Events/Quote/QuoteWasRestored.php b/app/Events/Quote/QuoteWasRestored.php index 7af7fb27cee3..c98173af65e3 100644 --- a/app/Events/Quote/QuoteWasRestored.php +++ b/app/Events/Quote/QuoteWasRestored.php @@ -21,13 +21,15 @@ class QuoteWasRestored use SerializesModels; public $quote; + public $company; /** * Create a new event instance. * - * @param $quote + * @return void */ - public function __construct($quote) + public function __construct(Quote $quote, $company) { $this->quote = $quote; + $this->company = $company; } } diff --git a/app/Events/Quote/QuoteWasUpdated.php b/app/Events/Quote/QuoteWasUpdated.php index 38300cf2baab..540a9056f0fb 100644 --- a/app/Events/Quote/QuoteWasUpdated.php +++ b/app/Events/Quote/QuoteWasUpdated.php @@ -21,13 +21,14 @@ class QuoteWasUpdated use SerializesModels; public $quote; + public $company; /** * Create a new event instance. * - * @param $quote + * @return void */ - public function __construct($quote) + public function __construct(Quote $quote, $company) { $this->quote = $quote; + $this->company = $company; } -} diff --git a/app/Events/Task/TaskWasArchived.php b/app/Events/Task/TaskWasArchived.php index 7bc3d39d3b46..19ef5edcdac6 100644 --- a/app/Events/Task/TaskWasArchived.php +++ b/app/Events/Task/TaskWasArchived.php @@ -26,13 +26,16 @@ class TaskWasArchived */ public $task; + public $company; + /** * Create a new event instance. * * @param Task $task */ - public function __construct(Task $task) + public function __construct(Task $task, $company) { $this->task = $task; + $this->company = $company; } } diff --git a/app/Events/Task/TaskWasCreated.php b/app/Events/Task/TaskWasCreated.php index 5ae3f4d214e4..704805fa5f1c 100644 --- a/app/Events/Task/TaskWasCreated.php +++ b/app/Events/Task/TaskWasCreated.php @@ -26,13 +26,16 @@ class TaskWasCreated */ public $task; + public $company; + /** * Create a new event instance. * * @param Task $task */ - public function __construct(Task $task) + public function __construct(Task $task, $company) { $this->task = $task; + $this->company = $company; } } diff --git a/app/Events/Task/TaskWasDeleted.php b/app/Events/Task/TaskWasDeleted.php index 9cc8b3379d4b..17da40f6b54a 100644 --- a/app/Events/Task/TaskWasDeleted.php +++ b/app/Events/Task/TaskWasDeleted.php @@ -26,13 +26,16 @@ class TaskWasDeleted */ public $task; + public $company; + /** * Create a new event instance. * * @param Task $task */ - public function __construct(Task $task) + public function __construct(Task $task, $company) { $this->task = $task; + $this->company = $company; } } diff --git a/app/Events/Task/TaskWasRestored.php b/app/Events/Task/TaskWasRestored.php index 4abd979844cb..a028cc3f504e 100644 --- a/app/Events/Task/TaskWasRestored.php +++ b/app/Events/Task/TaskWasRestored.php @@ -26,13 +26,16 @@ class TaskWasRestored */ public $task; + public $company; + /** * Create a new event instance. * * @param Task $task */ - public function __construct(Task $task) + public function __construct(Task $task, $company) { $this->task = $task; + $this->company = $company; } } diff --git a/app/Events/Task/TaskWasUpdated.php b/app/Events/Task/TaskWasUpdated.php index 688c6bf0538c..8b913f39250b 100644 --- a/app/Events/Task/TaskWasUpdated.php +++ b/app/Events/Task/TaskWasUpdated.php @@ -26,13 +26,16 @@ class TaskWasUpdated */ public $task; + public $company; + /** * Create a new event instance. * * @param Task $task */ - public function __construct(Task $task) + public function __construct(Task $task, $company) { $this->task = $task; + $this->company = $company; } } diff --git a/app/Events/User/UserLoggedIn.php b/app/Events/User/UserLoggedIn.php index 3e23ed79d980..e27b352f67f0 100644 --- a/app/Events/User/UserLoggedIn.php +++ b/app/Events/User/UserLoggedIn.php @@ -32,14 +32,16 @@ class UserLoggedIn */ public $user; + public $company; /** * Create a new event instance. * * @return void */ - public function __construct($user) + public function __construct($user, $company) { $this->user = $user; + $this->company = $company; } /** diff --git a/app/Events/Vendor/VendorWasArchived.php b/app/Events/Vendor/VendorWasArchived.php index 754d626ea611..96c10ee9a7d3 100644 --- a/app/Events/Vendor/VendorWasArchived.php +++ b/app/Events/Vendor/VendorWasArchived.php @@ -27,13 +27,15 @@ class VendorWasArchived */ public $vendor; + public $company; /** * Create a new event instance. * * @param Vendor $vendor */ - public function __construct(Vendor $vendor) + public function __construct(Vendor $vendor, $company) { $this->vendor = $vendor; + $this->company = $company; } } diff --git a/app/Events/Vendor/VendorWasCreated.php b/app/Events/Vendor/VendorWasCreated.php index ee7d7260a1ba..cbe164bb8630 100644 --- a/app/Events/Vendor/VendorWasCreated.php +++ b/app/Events/Vendor/VendorWasCreated.php @@ -26,13 +26,15 @@ class VendorWasCreated */ public $vendor; + public $company; /** * Create a new event instance. * * @param Vendor $vendor */ - public function __construct(Vendor $vendor) + public function __construct(Vendor $vendor, $company) { $this->vendor = $vendor; + $this->company = $company; } } diff --git a/app/Events/Vendor/VendorWasDeleted.php b/app/Events/Vendor/VendorWasDeleted.php index afc6cbefde13..abfe4e2a9f56 100644 --- a/app/Events/Vendor/VendorWasDeleted.php +++ b/app/Events/Vendor/VendorWasDeleted.php @@ -26,13 +26,15 @@ class VendorWasDeleted */ public $vendor; + public $company; /** * Create a new event instance. * * @param Vendor $vendor */ - public function __construct(Vendor $vendor) + public function __construct(Vendor $vendor, $company) { $this->vendor = $vendor; + $this->company = $company; } } diff --git a/app/Events/Vendor/VendorWasRestored.php b/app/Events/Vendor/VendorWasRestored.php index 8f00f495d095..c2d27fe1afd8 100644 --- a/app/Events/Vendor/VendorWasRestored.php +++ b/app/Events/Vendor/VendorWasRestored.php @@ -26,13 +26,15 @@ class VendorWasRestored */ public $vendor; + public $company; /** * Create a new event instance. * * @param Vendor $vendor */ - public function __construct(Vendor $vendor) + public function __construct(Vendor $vendor, $company) { $this->vendor = $vendor; + $this->company = $company; } } diff --git a/app/Events/Vendor/VendorWasUpdated.php b/app/Events/Vendor/VendorWasUpdated.php index 1ae648d5fa3b..2f9192d24329 100644 --- a/app/Events/Vendor/VendorWasUpdated.php +++ b/app/Events/Vendor/VendorWasUpdated.php @@ -26,13 +26,15 @@ class VendorWasUpdated */ public $vendor; + public $company; /** * Create a new event instance. * * @param Vendor $vendor */ - public function __construct(Vendor $vendor) + public function __construct(Vendor $vendor, $company) { $this->vendor = $vendor; + $this->company = $company; } } diff --git a/app/Http/Controllers/Auth/ContactLoginController.php b/app/Http/Controllers/Auth/ContactLoginController.php index c292b87aeffa..5a1a805008e7 100644 --- a/app/Http/Controllers/Auth/ContactLoginController.php +++ b/app/Http/Controllers/Auth/ContactLoginController.php @@ -63,7 +63,7 @@ class ContactLoginController extends Controller { Auth::guard('contact')->login($client, true); - event(new ContactLoggedIn($client)); + event(new ContactLoggedIn($client, $client->company)); if (session()->get('url.intended')) { return redirect(session()->get('url.intended')); diff --git a/app/Http/Controllers/ClientPortal/InvitationController.php b/app/Http/Controllers/ClientPortal/InvitationController.php index fe06f648af7a..f833cdbd3021 100644 --- a/app/Http/Controllers/ClientPortal/InvitationController.php +++ b/app/Http/Controllers/ClientPortal/InvitationController.php @@ -47,7 +47,7 @@ class InvitationController extends Controller if (!request()->has('silent')) { $invitation->markViewed(); - event(new InvitationWasViewed($entity, $invitation)); + event(new InvitationWasViewed($entity, $invitation, $entity->company)); } return redirect()->route('client.'.$entity.'.show', [$entity => $this->encodePrimaryKey($invitation->{$key})]); diff --git a/app/Http/Controllers/InvoiceController.php b/app/Http/Controllers/InvoiceController.php index fa22c7ac82da..c2a3e946bef4 100644 --- a/app/Http/Controllers/InvoiceController.php +++ b/app/Http/Controllers/InvoiceController.php @@ -716,7 +716,7 @@ class InvoiceController extends BaseController }); if ($invoice->invitations->count() > 0) { - event(new InvoiceWasEmailed($invoice->invitations->first())); + event(new InvoiceWasEmailed($invoice->invitations->first(), $invoice->company)); } if (!$bulk) { diff --git a/app/Http/Middleware/ContactTokenAuth.php b/app/Http/Middleware/ContactTokenAuth.php index b0c7ec4b7a06..96f06d0fb085 100644 --- a/app/Http/Middleware/ContactTokenAuth.php +++ b/app/Http/Middleware/ContactTokenAuth.php @@ -53,7 +53,7 @@ class ContactTokenAuth //stateless, don't remember the contact. auth()->guard('contact')->login($client_contact, false); - event(new ContactLoggedIn($client_contact)); //todo + event(new ContactLoggedIn($client_contact, $client_contact->company)); //todo } else { $error = [ 'message' => 'Invalid token', diff --git a/app/Jobs/Account/CreateAccount.php b/app/Jobs/Account/CreateAccount.php index 2c9a74e6b937..daedb63e4fb3 100644 --- a/app/Jobs/Account/CreateAccount.php +++ b/app/Jobs/Account/CreateAccount.php @@ -72,7 +72,7 @@ class CreateAccount $sp2d97e8 = CreateCompanyToken::dispatchNow($sp035a66, $spaa9f78, $spafe62e); if ($spaa9f78) { - event(new AccountCreated($spaa9f78)); + event(new AccountCreated($spaa9f78, $sp035a66)); } $spaa9f78->fresh(); diff --git a/app/Jobs/Credit/EmailCredit.php b/app/Jobs/Credit/EmailCredit.php index f4a66f2200b1..c045b4e5305a 100644 --- a/app/Jobs/Credit/EmailCredit.php +++ b/app/Jobs/Credit/EmailCredit.php @@ -69,13 +69,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, Mail::failures())); + event(new CreditWasEmailedAndFailed($this->credit, $this->credit->company, Mail::failures())); return $this->logMailError($errors); } //fire any events - event(new CreditWasEmailed($this->credit)); + event(new CreditWasEmailed($this->credit, $this->company)); //sleep(5); } diff --git a/app/Jobs/Util/ReminderJob.php b/app/Jobs/Util/ReminderJob.php index 19bc52081f8f..0c1510af3733 100644 --- a/app/Jobs/Util/ReminderJob.php +++ b/app/Jobs/Util/ReminderJob.php @@ -74,7 +74,7 @@ class ReminderJob implements ShouldQueue }); if ($invoice->invitations->count() > 0) { - event(new InvoiceWasEmailed($invoice->invitations->first())); + event(new InvoiceWasEmailed($invoice->invitations->first(), $invoice->company)); } } else { diff --git a/app/Observers/ClientObserver.php b/app/Observers/ClientObserver.php index 47405f438242..3a5d86512ef7 100644 --- a/app/Observers/ClientObserver.php +++ b/app/Observers/ClientObserver.php @@ -26,7 +26,7 @@ class ClientObserver */ public function created(Client $client) { - event(new ClientWasCreated($client)); + event(new ClientWasCreated($client, $client->company)); SubscriptionHandler::dispatch(Subscription::EVENT_CREATE_CLIENT, $client); } diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index df8fc4cad950..3e1f1718bdd1 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -21,6 +21,7 @@ use App\Events\Client\DesignWasRestored; use App\Events\Client\DesignWasUpdated; use App\Events\Company\CompanyWasDeleted; use App\Events\Contact\ContactLoggedIn; +use App\Events\Credit\CreditWasEmailedAndFailed; use App\Events\Credit\CreditWasMarkedSent; use App\Events\Design\DesignWasArchived; use App\Events\Invoice\InvoiceWasCancelled; @@ -122,6 +123,10 @@ class EventServiceProvider extends ServiceProvider ], DocumentWasRestored::class =>[ ], + CreditWasEmailedAndFailed::class => [ + ], + CreditWasEmailed::class => [ + ], CreditWasMarkedSent::class => [ ], //Designs diff --git a/app/Repositories/BaseRepository.php b/app/Repositories/BaseRepository.php index cd007eb6b3bf..cacea5dd9511 100644 --- a/app/Repositories/BaseRepository.php +++ b/app/Repositories/BaseRepository.php @@ -78,7 +78,7 @@ class BaseRepository $className = $this->getEventClass($entity, 'Archived'); if (class_exists($className)) { - event(new $className($entity)); + event(new $className($entity, $entity->company)); } } @@ -104,7 +104,7 @@ class BaseRepository $className = $this->getEventClass($entity, 'Restored'); if (class_exists($className)) { - event(new $className($entity, $fromDeleted)); + event(new $className($entity, $fromDeleted, $entity->company)); } } @@ -125,7 +125,7 @@ class BaseRepository $className = $this->getEventClass($entity, 'Deleted'); if (class_exists($className)) { - event(new $className($entity)); + event(new $className($entity, $entity->company)); } } diff --git a/app/Repositories/InvoiceRepository.php b/app/Repositories/InvoiceRepository.php index e5f828f8ac47..8a1d0a0ca6d7 100644 --- a/app/Repositories/InvoiceRepository.php +++ b/app/Repositories/InvoiceRepository.php @@ -89,7 +89,7 @@ class InvoiceRepository extends BaseRepository $invoice->delete(); - event(new InvoiceWasDeleted($invoice)); + event(new InvoiceWasDeleted($invoice, $invoice->company)); return $invoice; } diff --git a/app/Services/Invoice/HandleCancellation.php b/app/Services/Invoice/HandleCancellation.php index 4b206867ea34..9ec42f86c412 100644 --- a/app/Services/Invoice/HandleCancellation.php +++ b/app/Services/Invoice/HandleCancellation.php @@ -57,7 +57,7 @@ class HandleCancellation extends AbstractService //adjust client balance $this->invoice->client->service()->updateBalance($adjustment)->save(); - event(new InvoiceWasCancelled($this->invoice)); + event(new InvoiceWasCancelled($this->invoice, $this->invoice->company)); return $this->invoice; diff --git a/app/Services/Invoice/HandleReversal.php b/app/Services/Invoice/HandleReversal.php index 0e66f3020044..961dfd6d18f8 100644 --- a/app/Services/Invoice/HandleReversal.php +++ b/app/Services/Invoice/HandleReversal.php @@ -109,7 +109,7 @@ class HandleReversal extends AbstractService ->updatePaidToDate($total_paid*-1) ->save(); - event(new InvoiceWasReversed($this->invoice)); + event(new InvoiceWasReversed($this->invoice, $this->invoice->company)); return $this->invoice; //create a ledger row for this with the resulting Credit ( also include an explanation in the notes section )