Send company with all events

This commit is contained in:
David Bomba 2020-06-30 09:35:17 +10:00
parent 27d2f18cc7
commit 245980ce4b
78 changed files with 250 additions and 135 deletions

View File

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

View File

@ -12,13 +12,14 @@
namespace App\Events\Client; namespace App\Events\Client;
use App\Models\Client; use App\Models\Client;
use App\Models\Company;
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 ClientWasArchived. * Class ClientWasArchived.
@ -32,14 +33,16 @@ class ClientWasArchived
*/ */
public $client; public $client;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Client $client * @param Client $client
*/ */
public function __construct(Client $client) public function __construct(Client $client, Company $company)
{ {
$this->client = $client; $this->client = $client;
$this->company = $company;
} }
/** /**

View File

@ -26,13 +26,15 @@ class ClientWasCreated
*/ */
public $client; public $client;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Client $client * @param Client $client
*/ */
public function __construct(Client $client) public function __construct(Client $client, Company $company)
{ {
$this->client = $client; $this->client = $client;
$this->company = $company;
} }
} }

View File

@ -26,13 +26,15 @@ class ClientWasDeleted
*/ */
public $client; public $client;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Client $client * @param Client $client
*/ */
public function __construct(Client $client) public function __construct(Client $client, Company $company)
{ {
$this->client = $client; $this->client = $client;
$this->company = $company;
} }
} }

View File

@ -26,13 +26,15 @@ class ClientWasRestored
*/ */
public $client; public $client;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Client $client * @param Client $client
*/ */
public function __construct(Client $client) public function __construct(Client $client, Company $company)
{ {
$this->client = $client; $this->client = $client;
$this->company = $company;
} }
} }

View File

@ -26,13 +26,15 @@ class ClientWasUpdated
*/ */
public $client; public $client;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Client $client * @param Client $client
*/ */
public function __construct(Client $client) public function __construct(Client $client, Company $company)
{ {
$this->client = $client; $this->client = $client;
$this->company = $company;
} }
} }

View File

@ -1,42 +0,0 @@
<?php
namespace App\Events\CompanyToken;
use App\Models\CompanyToken;
use Illuminate\Broadcasting\Channel;
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 CompanyTokenWasDeleted
{
use Dispatchable, InteractsWithSockets, SerializesModels;
/**
* @var Company
*/
public $company_token;
/**
* Create a new event instance.
*
* @param Company $company
*/
public function __construct(CompanyToken $company_token)
{
$this->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');
}
}

View File

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

View File

@ -13,13 +13,16 @@ class CreditWasEmailed
public $credit; public $credit;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @return void * @return void
*/ */
public function __construct(Credit $credit) public function __construct(Credit $credit, $company)
{ {
$this->credit = $credit; $this->credit = $credit;
$this->company = $company;
} }
} }

View File

@ -15,10 +15,14 @@ class CreditWasEmailedAndFailed
public $errors; public $errors;
public function __construct(Credit $credit, array $errors) public $company;
public function __construct(Credit $credit, $company, array $errors)
{ {
$this->credit = $credit; $this->credit = $credit;
$this->company = $company;
$this->errors = $errors; $this->errors = $errors;
} }
} }

View File

@ -32,14 +32,17 @@ class DesignWasArchived
*/ */
public $design; public $design;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Design $design * @param Design $design
*/ */
public function __construct(Design $design) public function __construct(Design $design, $company)
{ {
$this->design = $design; $this->design = $design;
$this->company = $company;
} }
/** /**

View File

@ -26,14 +26,17 @@ class DesignWasCreated
*/ */
public $design; public $design;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Design $design * @param Design $design
*/ */
public function __construct(Design $design) public function __construct(Design $design, $company)
{ {
$this->design = $design; $this->design = $design;
$this->company = $company;
} }
/** /**

View File

@ -26,14 +26,17 @@ class DesignWasDeleted
*/ */
public $design; public $design;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Design $design * @param Design $design
*/ */
public function __construct(Design $design) public function __construct(Design $design, $company)
{ {
$this->design = $design; $this->design = $design;
$this->company = $company;
} }
/** /**

View File

@ -26,14 +26,17 @@ class DesignWasRestored
*/ */
public $design; public $design;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Design $design * @param Design $design
*/ */
public function __construct(Design $design) public function __construct(Design $design, $company)
{ {
$this->design = $design; $this->design = $design;
$this->company = $company;
} }
/** /**

View File

@ -26,14 +26,17 @@ class DesignWasUpdated
*/ */
public $design; public $design;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Design $design * @param Design $design
*/ */
public function __construct(Design $design) public function __construct(Design $design, $company)
{ {
$this->design = $design; $this->design = $design;
$this->company = $company;
} }
/** /**

View File

@ -32,14 +32,16 @@ class DocumentWasArchived
*/ */
public $document; public $document;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Document $document * @param Document $document
*/ */
public function __construct(Document $document) public function __construct(Document $document, $company)
{ {
$this->document = $document; $this->document = $document;
$this->company = $company;
} }
/** /**

View File

@ -26,13 +26,15 @@ class DocumentWasCreated
*/ */
public $document; public $document;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Document $document * @param Document $document
*/ */
public function __construct(Document $document) public function __construct(Document $document, $company)
{ {
$this->document = $document; $this->document = $document;
$this->company = $company;
} }
} }

View File

@ -26,13 +26,15 @@ class DocumentWasDeleted
*/ */
public $document; public $document;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Document $document * @param Document $document
*/ */
public function __construct(Document $document) public function __construct(Document $document, $company)
{ {
$this->document = $document; $this->document = $document;
$this->company = $company;
} }
} }

View File

@ -26,13 +26,15 @@ class DocumentWasRestored
*/ */
public $document; public $document;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Document $document * @param Document $document
*/ */
public function __construct(Document $document) public function __construct(Document $document, $company)
{ {
$this->document = $document; $this->document = $document;
$this->company = $company;
} }
} }

View File

@ -26,13 +26,15 @@ class DocumentWasUpdated
*/ */
public $document; public $document;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Document $document * @param Document $document
*/ */
public function __construct(Document $document) public function __construct(Document $document, $company)
{ {
$this->document = $document; $this->document = $document;
$this->company = $company;
} }
} }

View File

@ -26,13 +26,15 @@ class ExpenseWasArchived
*/ */
public $expense; public $expense;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Expense $expense * @param Expense $expense
*/ */
public function __construct(Expense $expense) public function __construct(Expense $expense, $company)
{ {
$this->expense = $expense; $this->expense = $expense;
$this->company = $company;
} }
} }

View File

@ -26,13 +26,15 @@ class ExpenseWasCreated
*/ */
public $expense; public $expense;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Expense $expense * @param Expense $expense
*/ */
public function __construct(Expense $expense) public function __construct(Expense $expense, $company)
{ {
$this->expense = $expense; $this->expense = $expense;
$this->company = $company;
} }
} }

View File

@ -26,13 +26,15 @@ class ExpenseWasDeleted
*/ */
public $expense; public $expense;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Expense $expense * @param Expense $expense
*/ */
public function __construct(Expense $expense) public function __construct(Expense $expense, $company)
{ {
$this->expense = $expense; $this->expense = $expense;
$this->company = $company;
} }
} }

View File

@ -26,13 +26,15 @@ class ExpenseWasRestored
*/ */
public $expense; public $expense;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Expense $expense * @param Expense $expense
*/ */
public function __construct(Expense $expense) public function __construct(Expense $expense, $company)
{ {
$this->expense = $expense; $this->expense = $expense;
$this->company = $company;
} }
} }

View File

@ -26,13 +26,15 @@ class ExpenseWasUpdated
*/ */
public $expense; public $expense;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Expense $expense * @param Expense $expense
*/ */
public function __construct(Expense $expense) public function __construct(Expense $expense, $company)
{ {
$this->expense = $expense; $this->expense = $expense;
$this->company = $company;
} }
} }

View File

@ -26,13 +26,15 @@ class InvoiceWasArchived
*/ */
public $invoice; public $invoice;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Invoice $invoice * @param Invoice $invoice
*/ */
public function __construct(Invoice $invoice) public function __construct(Invoice $invoice, $company)
{ {
$this->invoice = $invoice; $this->invoice = $invoice;
$this->company = $company;
} }
} }

View File

@ -26,13 +26,15 @@ class InvoiceWasCancelled
*/ */
public $invoice; public $invoice;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Invoice $invoice * @param Invoice $invoice
*/ */
public function __construct(Invoice $invoice) public function __construct(Invoice $invoice, $company)
{ {
$this->invoice = $invoice; $this->invoice = $invoice;
$this->company = $company;
} }
} }

View File

@ -26,13 +26,15 @@ class InvoiceWasDeleted
*/ */
public $invoice; public $invoice;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Invoice $invoice * @param Invoice $invoice
*/ */
public function __construct(Invoice $invoice) public function __construct(Invoice $invoice, $company)
{ {
$this->invoice = $invoice; $this->invoice = $invoice;
$this->company = $company;
} }
} }

View File

@ -26,13 +26,15 @@ class InvoiceWasEmailed
*/ */
public $invitation; public $invitation;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Invoice $invoice * @param Invoice $invoice
*/ */
public function __construct(InvoiceInvitation $invitation) public function __construct(InvoiceInvitation $invitation, $company)
{ {
$this->invitation = $invitation; $this->invitation = $invitation;
$this->company = $company;
} }
} }

View File

@ -31,15 +31,19 @@ class InvoiceWasEmailedAndFailed
*/ */
public $errors; public $errors;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Invoice $invoice * @param Invoice $invoice
*/ */
public function __construct(Invoice $invoice, array $errors) public function __construct(Invoice $invoice, $company, array $errors)
{ {
$this->invoice = $invoice; $this->invoice = $invoice;
$this->company = $company;
$this->errors = $errors; $this->errors = $errors;
} }
} }

View File

@ -28,15 +28,17 @@ class InvoiceWasRestored
public $fromDeleted; public $fromDeleted;
public $company;
/** /**
* 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) public function __construct(Invoice $invoice, $fromDeleted, $company)
{ {
$this->invoice = $invoice; $this->invoice = $invoice;
$this->fromDeleted = $fromDeleted; $this->fromDeleted = $fromDeleted;
$this->company = $company;
} }
} }

View File

@ -26,13 +26,15 @@ class InvoiceWasReversed
*/ */
public $invoice; public $invoice;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Invoice $invoice * @param Invoice $invoice
*/ */
public function __construct(Invoice $invoice) public function __construct(Invoice $invoice, $company)
{ {
$this->invoice = $invoice; $this->invoice = $invoice;
$this->company = $company;
} }
} }

View File

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

View File

@ -20,14 +20,16 @@ class MethodDeleted
*/ */
private $payment_method; private $payment_method;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param ClientGatewayToken $payment_method * @param ClientGatewayToken $payment_method
*/ */
public function __construct(ClientGatewayToken $payment_method) public function __construct(ClientGatewayToken $payment_method, $company)
{ {
$this->payment_method = $payment_method; $this->payment_method = $payment_method;
$this->company = $company;
} }
/** /**

View File

@ -26,13 +26,15 @@ class PaymentCompleted
*/ */
public $payment; public $payment;
public $company
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Payment $payment * @param Payment $payment
*/ */
public function __construct(Payment $payment) public function __construct(Payment $payment, $company)
{ {
$this->payment = $payment; $this->payment = $payment;
$this->company = $company;
} }
} }

View File

@ -26,13 +26,15 @@ class PaymentFailed
*/ */
public $payment; public $payment;
public $company
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Payment $payment * @param Payment $payment
*/ */
public function __construct(Payment $payment) public function __construct(Payment $payment, $company)
{ {
$this->payment = $payment; $this->payment = $payment;
$this->company = $company;
} }
} }

View File

@ -26,13 +26,15 @@ class PaymentWasArchived
*/ */
public $payment; public $payment;
public $company
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Payment $payment * @param Payment $payment
*/ */
public function __construct(Payment $payment) public function __construct(Payment $payment, $company)
{ {
$this->payment = $payment; $this->payment = $payment;
$this->company = $company;
} }
} }

View File

@ -26,13 +26,15 @@ class PaymentWasDeleted
*/ */
public $payment; public $payment;
public $company
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Payment $payment * @param Payment $payment
*/ */
public function __construct(Payment $payment) public function __construct(Payment $payment, $company)
{ {
$this->payment = $payment; $this->payment = $payment;
$this->company = $company;
} }
} }

View File

@ -26,12 +26,15 @@ class PaymentWasEmailed
*/ */
public $payment; public $payment;
public $company
/** /**
* PaymentWasEmailed constructor. * Create a new event instance.
*
* @param Payment $payment * @param Payment $payment
*/ */
public function __construct(Payment $payment) public function __construct(Payment $payment, $company)
{ {
$this->payment = $payment; $this->payment = $payment;
$this->company = $company;
} }
} }

View File

@ -31,15 +31,18 @@ class PaymentWasEmailedAndFailed
*/ */
public $errors; public $errors;
public $company;
/** /**
* PaymentWasEmailedAndFailed constructor. * PaymentWasEmailedAndFailed constructor.
* @param Payment $payment * @param Payment $payment
* @param array $errors * @param array $errors
*/ */
public function __construct(Payment $payment, array $errors) public function __construct(Payment $payment, $company, array $errors)
{ {
$this->payment = $payment; $this->payment = $payment;
$this->errors = $errors; $this->errors = $errors;
$this->company = $company;
} }
} }

View File

@ -28,15 +28,17 @@ class PaymentWasRefunded
public $refund_amount; public $refund_amount;
public $company;
/** /**
* 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) public function __construct(Payment $payment, $refund_amount, $company)
{ {
$this->payment = $payment; $this->payment = $payment;
$this->refund_amount = $refund_amount; $this->refund_amount = $refund_amount;
$this->company = $company;
} }
} }

View File

@ -26,16 +26,17 @@ class PaymentWasRestored
*/ */
public $payment; public $payment;
public $fromDeleted; public $fromDeleted;
public $company;
/** /**
* 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) public function __construct(Payment $payment, $fromDeleted, $company)
{ {
$this->payment = $payment; $this->payment = $payment;
$this->fromDeleted = $fromDeleted; $this->fromDeleted = $fromDeleted;
$this->company = $company;
} }
} }

View File

@ -26,13 +26,15 @@ class PaymentWasVoided
*/ */
public $payment; public $payment;
public $company
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Payment $payment * @param Payment $payment
*/ */
public function __construct(Payment $payment) public function __construct(Payment $payment, $company)
{ {
$this->payment = $payment; $this->payment = $payment;
$this->company = $company;
} }
} }

View File

@ -28,14 +28,17 @@ class ProductWasCreated
**/ **/
public $input; public $input;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @return void * @return void
*/ */
public function __construct(Product $product, $input = null) public function __construct(Product $product, $input = null, $company)
{ {
$this->product = $product; $this->product = $product;
$this->input = $input; $this->input = $input;
$this->company = $company;
} }
} }

View File

@ -23,13 +23,15 @@ class ProductWasDeleted
*/ */
public $product; public $product;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @return void * @return void
*/ */
public function __construct(Product $product) public function __construct(Product $product, $company)
{ {
$this->product = $product; $this->product = $product;
$this->company = $company;
} }
} }

View File

@ -28,14 +28,17 @@ class ProductWasUpdated
**/ **/
public $input; public $input;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @return void * @return void
*/ */
public function __construct(Product $product, $input = null) public function __construct(Product $product, $input = null, $company)
{ {
$this->product = $product; $this->product = $product;
$this->input = $input; $this->input = $input;
$this->company = $company;
} }
} }

View File

@ -17,13 +17,15 @@ class QuoteWasApproved
public $quote; public $quote;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @return void * @return void
*/ */
public function __construct(Quote $quote) public function __construct(Quote $quote, $company)
{ {
$this->quote = $quote; $this->quote = $quote;
$this->company = $company;
} }
} }

View File

@ -18,14 +18,15 @@ class QuoteWasArchived
use SerializesModels; use SerializesModels;
public $quote; public $quote;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param $quote * @return void
*/ */
public function __construct($quote) public function __construct(Quote $quote, $company)
{ {
$this->quote = $quote; $this->quote = $quote;
$this->company = $company;
} }
} }

View File

@ -19,15 +19,17 @@ use Illuminate\Queue\SerializesModels;
class QuoteWasCreated class QuoteWasCreated
{ {
use SerializesModels; use SerializesModels;
public $quote;
public $quote;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param $quote * @return void
*/ */
public function __construct($quote) public function __construct(Quote $quote, $company)
{ {
$this->quote = $quote; $this->quote = $quote;
$this->company = $company;
} }
} }

View File

@ -21,13 +21,15 @@ class QuoteWasDeleted
use SerializesModels; use SerializesModels;
public $quote; public $quote;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param $quote * @return void
*/ */
public function __construct($quote) public function __construct(Quote $quote, $company)
{ {
$this->quote = $quote; $this->quote = $quote;
$this->company = $company;
} }
} }

View File

@ -19,8 +19,11 @@ use Illuminate\Queue\SerializesModels;
class QuoteWasEmailed class QuoteWasEmailed
{ {
use SerializesModels; use SerializesModels;
public $quote; public $quote;
public $company;
/** /**
* @var string * @var string
*/ */
@ -31,9 +34,11 @@ class QuoteWasEmailed
* *
* @param $quote * @param $quote
*/ */
public function __construct($quote, $notes) public function __construct($quote, $notes, $company)
{ {
$this->quote = $quote; $this->quote = $quote;
$this->notes = $notes; $this->notes = $notes;
$this->company = $company;
} }
} }

View File

@ -26,6 +26,8 @@ class QuoteWasEmailedAndFailed
*/ */
public $quote; public $quote;
public $company;
/** /**
* @var array * @var array
*/ */
@ -36,10 +38,12 @@ class QuoteWasEmailedAndFailed
* @param Quote $quote * @param Quote $quote
* @param array $errors * @param array $errors
*/ */
public function __construct(Quote $quote, array $errors) public function __construct(Quote $quote, array $errors, $company)
{ {
$this->quote = $quote; $this->quote = $quote;
$this->errors = $errors; $this->errors = $errors;
$this->company = $company;
} }
} }

View File

@ -21,13 +21,15 @@ class QuoteWasRestored
use SerializesModels; use SerializesModels;
public $quote; public $quote;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param $quote * @return void
*/ */
public function __construct($quote) public function __construct(Quote $quote, $company)
{ {
$this->quote = $quote; $this->quote = $quote;
$this->company = $company;
} }
} }

View File

@ -21,13 +21,14 @@ class QuoteWasUpdated
use SerializesModels; use SerializesModels;
public $quote; public $quote;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param $quote * @return void
*/ */
public function __construct($quote) public function __construct(Quote $quote, $company)
{ {
$this->quote = $quote; $this->quote = $quote;
$this->company = $company;
} }
}

View File

@ -26,13 +26,16 @@ class TaskWasArchived
*/ */
public $task; public $task;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Task $task * @param Task $task
*/ */
public function __construct(Task $task) public function __construct(Task $task, $company)
{ {
$this->task = $task; $this->task = $task;
$this->company = $company;
} }
} }

View File

@ -26,13 +26,16 @@ class TaskWasCreated
*/ */
public $task; public $task;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Task $task * @param Task $task
*/ */
public function __construct(Task $task) public function __construct(Task $task, $company)
{ {
$this->task = $task; $this->task = $task;
$this->company = $company;
} }
} }

View File

@ -26,13 +26,16 @@ class TaskWasDeleted
*/ */
public $task; public $task;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Task $task * @param Task $task
*/ */
public function __construct(Task $task) public function __construct(Task $task, $company)
{ {
$this->task = $task; $this->task = $task;
$this->company = $company;
} }
} }

View File

@ -26,13 +26,16 @@ class TaskWasRestored
*/ */
public $task; public $task;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Task $task * @param Task $task
*/ */
public function __construct(Task $task) public function __construct(Task $task, $company)
{ {
$this->task = $task; $this->task = $task;
$this->company = $company;
} }
} }

View File

@ -26,13 +26,16 @@ class TaskWasUpdated
*/ */
public $task; public $task;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Task $task * @param Task $task
*/ */
public function __construct(Task $task) public function __construct(Task $task, $company)
{ {
$this->task = $task; $this->task = $task;
$this->company = $company;
} }
} }

View File

@ -32,14 +32,16 @@ class UserLoggedIn
*/ */
public $user; public $user;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @return void * @return void
*/ */
public function __construct($user) public function __construct($user, $company)
{ {
$this->user = $user; $this->user = $user;
$this->company = $company;
} }
/** /**

View File

@ -27,13 +27,15 @@ class VendorWasArchived
*/ */
public $vendor; public $vendor;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Vendor $vendor * @param Vendor $vendor
*/ */
public function __construct(Vendor $vendor) public function __construct(Vendor $vendor, $company)
{ {
$this->vendor = $vendor; $this->vendor = $vendor;
$this->company = $company;
} }
} }

View File

@ -26,13 +26,15 @@ class VendorWasCreated
*/ */
public $vendor; public $vendor;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Vendor $vendor * @param Vendor $vendor
*/ */
public function __construct(Vendor $vendor) public function __construct(Vendor $vendor, $company)
{ {
$this->vendor = $vendor; $this->vendor = $vendor;
$this->company = $company;
} }
} }

View File

@ -26,13 +26,15 @@ class VendorWasDeleted
*/ */
public $vendor; public $vendor;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Vendor $vendor * @param Vendor $vendor
*/ */
public function __construct(Vendor $vendor) public function __construct(Vendor $vendor, $company)
{ {
$this->vendor = $vendor; $this->vendor = $vendor;
$this->company = $company;
} }
} }

View File

@ -26,13 +26,15 @@ class VendorWasRestored
*/ */
public $vendor; public $vendor;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Vendor $vendor * @param Vendor $vendor
*/ */
public function __construct(Vendor $vendor) public function __construct(Vendor $vendor, $company)
{ {
$this->vendor = $vendor; $this->vendor = $vendor;
$this->company = $company;
} }
} }

View File

@ -26,13 +26,15 @@ class VendorWasUpdated
*/ */
public $vendor; public $vendor;
public $company;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param Vendor $vendor * @param Vendor $vendor
*/ */
public function __construct(Vendor $vendor) public function __construct(Vendor $vendor, $company)
{ {
$this->vendor = $vendor; $this->vendor = $vendor;
$this->company = $company;
} }
} }

View File

@ -63,7 +63,7 @@ class ContactLoginController extends Controller
{ {
Auth::guard('contact')->login($client, true); Auth::guard('contact')->login($client, true);
event(new ContactLoggedIn($client)); event(new ContactLoggedIn($client, $client->company));
if (session()->get('url.intended')) { if (session()->get('url.intended')) {
return redirect(session()->get('url.intended')); return redirect(session()->get('url.intended'));

View File

@ -47,7 +47,7 @@ class InvitationController extends Controller
if (!request()->has('silent')) { if (!request()->has('silent')) {
$invitation->markViewed(); $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})]); return redirect()->route('client.'.$entity.'.show', [$entity => $this->encodePrimaryKey($invitation->{$key})]);

View File

@ -716,7 +716,7 @@ class InvoiceController extends BaseController
}); });
if ($invoice->invitations->count() > 0) { if ($invoice->invitations->count() > 0) {
event(new InvoiceWasEmailed($invoice->invitations->first())); event(new InvoiceWasEmailed($invoice->invitations->first(), $invoice->company));
} }
if (!$bulk) { if (!$bulk) {

View File

@ -53,7 +53,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)); //todo event(new ContactLoggedIn($client_contact, $client_contact->company)); //todo
} 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)); event(new AccountCreated($spaa9f78, $sp035a66));
} }
$spaa9f78->fresh(); $spaa9f78->fresh();

View File

@ -69,13 +69,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, Mail::failures())); event(new CreditWasEmailedAndFailed($this->credit, $this->credit->company, Mail::failures()));
return $this->logMailError($errors); return $this->logMailError($errors);
} }
//fire any events //fire any events
event(new CreditWasEmailed($this->credit)); event(new CreditWasEmailed($this->credit, $this->company));
//sleep(5); //sleep(5);
} }

View File

@ -74,7 +74,7 @@ class ReminderJob implements ShouldQueue
}); });
if ($invoice->invitations->count() > 0) { if ($invoice->invitations->count() > 0) {
event(new InvoiceWasEmailed($invoice->invitations->first())); event(new InvoiceWasEmailed($invoice->invitations->first(), $invoice->company));
} }
} else { } else {

View File

@ -26,7 +26,7 @@ class ClientObserver
*/ */
public function created(Client $client) public function created(Client $client)
{ {
event(new ClientWasCreated($client)); event(new ClientWasCreated($client, $client->company));
SubscriptionHandler::dispatch(Subscription::EVENT_CREATE_CLIENT, $client); SubscriptionHandler::dispatch(Subscription::EVENT_CREATE_CLIENT, $client);
} }

View File

@ -21,6 +21,7 @@ use App\Events\Client\DesignWasRestored;
use App\Events\Client\DesignWasUpdated; use App\Events\Client\DesignWasUpdated;
use App\Events\Company\CompanyWasDeleted; use App\Events\Company\CompanyWasDeleted;
use App\Events\Contact\ContactLoggedIn; use App\Events\Contact\ContactLoggedIn;
use App\Events\Credit\CreditWasEmailedAndFailed;
use App\Events\Credit\CreditWasMarkedSent; use App\Events\Credit\CreditWasMarkedSent;
use App\Events\Design\DesignWasArchived; use App\Events\Design\DesignWasArchived;
use App\Events\Invoice\InvoiceWasCancelled; use App\Events\Invoice\InvoiceWasCancelled;
@ -122,6 +123,10 @@ class EventServiceProvider extends ServiceProvider
], ],
DocumentWasRestored::class =>[ DocumentWasRestored::class =>[
], ],
CreditWasEmailedAndFailed::class => [
],
CreditWasEmailed::class => [
],
CreditWasMarkedSent::class => [ CreditWasMarkedSent::class => [
], ],
//Designs //Designs

View File

@ -78,7 +78,7 @@ class BaseRepository
$className = $this->getEventClass($entity, 'Archived'); $className = $this->getEventClass($entity, 'Archived');
if (class_exists($className)) { 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'); $className = $this->getEventClass($entity, 'Restored');
if (class_exists($className)) { 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'); $className = $this->getEventClass($entity, 'Deleted');
if (class_exists($className)) { if (class_exists($className)) {
event(new $className($entity)); event(new $className($entity, $entity->company));
} }
} }

View File

@ -89,7 +89,7 @@ class InvoiceRepository extends BaseRepository
$invoice->delete(); $invoice->delete();
event(new InvoiceWasDeleted($invoice)); event(new InvoiceWasDeleted($invoice, $invoice->company));
return $invoice; return $invoice;
} }

View File

@ -57,7 +57,7 @@ class HandleCancellation extends AbstractService
//adjust client balance //adjust client balance
$this->invoice->client->service()->updateBalance($adjustment)->save(); $this->invoice->client->service()->updateBalance($adjustment)->save();
event(new InvoiceWasCancelled($this->invoice)); event(new InvoiceWasCancelled($this->invoice, $this->invoice->company));
return $this->invoice; return $this->invoice;

View File

@ -109,7 +109,7 @@ class HandleReversal extends AbstractService
->updatePaidToDate($total_paid*-1) ->updatePaidToDate($total_paid*-1)
->save(); ->save();
event(new InvoiceWasReversed($this->invoice)); event(new InvoiceWasReversed($this->invoice, $this->invoice->company));
return $this->invoice; return $this->invoice;
//create a ledger row for this with the resulting Credit ( also include an explanation in the notes section ) //create a ledger row for this with the resulting Credit ( also include an explanation in the notes section )