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 $company;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct($user)
public function __construct($user, $company)
{
$this->user = $user;
$this->company = $company;
}
/**

View File

@ -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;
}
/**

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

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 $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;
}
/**

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
/**

View File

@ -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;
}
/**

View File

@ -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;
}
/**

View File

@ -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;
}
/**

View File

@ -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;
}
/**

View File

@ -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;
}
/**

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
/**

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
/**

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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'));

View File

@ -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})]);

View File

@ -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) {

View File

@ -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',

View File

@ -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();

View File

@ -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);
}

View File

@ -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 {

View File

@ -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);
}

View File

@ -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

View File

@ -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));
}
}

View File

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

View File

@ -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;

View File

@ -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 )