mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
commit
c671bb4cef
@ -1 +1 @@
|
||||
5.0.9
|
||||
5.0.10
|
@ -20,6 +20,7 @@ use App\Jobs\Quote\CreateQuoteInvitations;
|
||||
use App\Listeners\Credit\CreateCreditInvitation;
|
||||
use App\Listeners\Invoice\CreateInvoiceInvitation;
|
||||
use App\Models\CompanyToken;
|
||||
use App\Models\Country;
|
||||
use App\Models\Payment;
|
||||
use App\Models\PaymentType;
|
||||
use App\Models\Product;
|
||||
@ -396,6 +397,14 @@ class CreateTestData extends Command
|
||||
]);
|
||||
|
||||
$client->id_number = $this->getNextClientNumber($client);
|
||||
|
||||
$settings = $client->settings;
|
||||
$settings->currency_id = (string)rand(1,79);
|
||||
$client->settings = $settings;
|
||||
|
||||
$country = Country::all()->random();
|
||||
|
||||
$client->country_id = $country->id;
|
||||
$client->save();
|
||||
|
||||
}
|
||||
|
@ -2,17 +2,37 @@
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\DataMapper\CompanySettings;
|
||||
use App\Events\Invoice\InvoiceWasCreated;
|
||||
use App\Factory\InvoiceFactory;
|
||||
use App\Factory\InvoiceItemFactory;
|
||||
use App\Helpers\Invoice\InvoiceSum;
|
||||
use App\Models\CompanyToken;
|
||||
use App\Models\Country;
|
||||
use App\Models\Product;
|
||||
use App\Models\User;
|
||||
use App\Repositories\InvoiceRepository;
|
||||
use App\Utils\Traits\GeneratesCounter;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use Carbon\Carbon;
|
||||
use Composer\Composer;
|
||||
use Composer\Console\Application;
|
||||
use Composer\Factory;
|
||||
use Composer\IO\NullIO;
|
||||
use Composer\Installer;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Str;
|
||||
use Symfony\Component\Console\Input\ArrayInput;
|
||||
use Composer\Console\Application;
|
||||
|
||||
class DemoMode extends Command
|
||||
{
|
||||
use MakesHash, GeneratesCounter;
|
||||
|
||||
private $count;
|
||||
|
||||
protected $name = 'ninja:demo-mode';
|
||||
/**
|
||||
@ -29,6 +49,15 @@ class DemoMode extends Command
|
||||
*/
|
||||
protected $description = 'Setup demo mode';
|
||||
|
||||
protected $invoice_repo;
|
||||
|
||||
public function __construct(InvoiceRepository $invoice_repo)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->invoice_repo = $invoice_repo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
@ -38,9 +67,446 @@ class DemoMode extends Command
|
||||
{
|
||||
set_time_limit(0);
|
||||
|
||||
Artisan::call('migrate:fresh');
|
||||
Artisan::call('db:seed');
|
||||
Artisan::call('db:seed --class=RandomDataSeeder');
|
||||
$this->info("Migrating");
|
||||
Artisan::call('migrate:fresh --force');
|
||||
|
||||
$this->info("Seeding");
|
||||
Artisan::call('db:seed --force');
|
||||
|
||||
$this->info("Seeding Random Data");
|
||||
$this->createSmallAccount();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private function createSmallAccount()
|
||||
{
|
||||
$this->count = 10;
|
||||
|
||||
$this->info('Creating Small Account and Company');
|
||||
|
||||
$account = factory(\App\Models\Account::class)->create();
|
||||
$company = factory(\App\Models\Company::class)->create([
|
||||
'account_id' => $account->id,
|
||||
'slack_webhook_url' => config('ninja.notification.slack'),
|
||||
]);
|
||||
|
||||
|
||||
$account->default_company_id = $company->id;
|
||||
$account->save();
|
||||
|
||||
$user = User::whereEmail('small@example.com')->first();
|
||||
|
||||
if (!$user) {
|
||||
$user = factory(\App\Models\User::class)->create([
|
||||
'account_id' => $account->id,
|
||||
'email' => 'small@example.com',
|
||||
'confirmation_code' => $this->createDbHash(config('database.default'))
|
||||
]);
|
||||
}
|
||||
|
||||
$company_token = new CompanyToken;
|
||||
$company_token->user_id = $user->id;
|
||||
$company_token->company_id = $company->id;
|
||||
$company_token->account_id = $account->id;
|
||||
$company_token->name = 'test token';
|
||||
$company_token->token = Str::random(64);
|
||||
$company_token->save();
|
||||
|
||||
$user->companies()->attach($company->id, [
|
||||
'account_id' => $account->id,
|
||||
'is_owner' => 1,
|
||||
'is_admin' => 1,
|
||||
'is_locked' => 0,
|
||||
'notifications' => CompanySettings::notificationDefaults(),
|
||||
// 'permissions' => '',
|
||||
'settings' => null,
|
||||
]);
|
||||
|
||||
$u2 = User::where('email', 'demo@invoiceninja.com')->first();
|
||||
|
||||
if(!$u2){
|
||||
|
||||
$u2 = factory(\App\Models\User::class)->create([
|
||||
'email' => 'demo@invoiceninja.com',
|
||||
'password' => Hash::make('demo'),
|
||||
'account_id' => $account->id,
|
||||
'confirmation_code' => $this->createDbHash(config('database.default'))
|
||||
]);
|
||||
|
||||
$company_token = new CompanyToken;
|
||||
$company_token->user_id = $u2->id;
|
||||
$company_token->company_id = $company->id;
|
||||
$company_token->account_id = $account->id;
|
||||
$company_token->name = 'test token';
|
||||
$company_token->token = 'TOKEN';
|
||||
$company_token->save();
|
||||
|
||||
$u2->companies()->attach($company->id, [
|
||||
'account_id' => $account->id,
|
||||
'is_owner' => 1,
|
||||
'is_admin' => 1,
|
||||
'is_locked' => 0,
|
||||
'notifications' => CompanySettings::notificationDefaults(),
|
||||
'permissions' => '',
|
||||
'settings' => null,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
factory(\App\Models\Product::class, 50)->create([
|
||||
'user_id' => $user->id,
|
||||
'company_id' => $company->id,
|
||||
]);
|
||||
|
||||
$this->info('Creating '.$this->count. ' clients');
|
||||
|
||||
for ($x=0; $x<$this->count; $x++) {
|
||||
$z = $x+1;
|
||||
$this->info("Creating client # ".$z);
|
||||
|
||||
$this->createClient($company, $user);
|
||||
}
|
||||
|
||||
for($x=0; $x<$this->count; $x++)
|
||||
{
|
||||
$client = $company->clients->random();
|
||||
|
||||
$this->info('creating invoice for client #'.$client->id);
|
||||
$this->createInvoice($client);
|
||||
|
||||
$client = $company->clients->random();
|
||||
|
||||
$this->info('creating credit for client #'.$client->id);
|
||||
$this->createCredit($client);
|
||||
|
||||
$client = $company->clients->random();
|
||||
|
||||
$this->info('creating quote for client #'.$client->id);
|
||||
$this->createQuote($client);
|
||||
|
||||
$client = $company->clients->random();
|
||||
|
||||
$this->info('creating expense for client #'.$client->id);
|
||||
$this->createExpense($client);
|
||||
|
||||
$client = $company->clients->random();
|
||||
|
||||
$this->info('creating vendor for client #'.$client->id);
|
||||
$this->createVendor($client);
|
||||
|
||||
$client = $company->clients->random();
|
||||
|
||||
$this->info('creating task for client #'.$client->id);
|
||||
$this->createTask($client);
|
||||
|
||||
$client = $company->clients->random();
|
||||
|
||||
$this->info('creating project for client #'.$client->id);
|
||||
$this->createProject($client);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function createClient($company, $user)
|
||||
{
|
||||
|
||||
// dispatch(function () use ($company, $user) {
|
||||
|
||||
// });
|
||||
$client = factory(\App\Models\Client::class)->create([
|
||||
'user_id' => $user->id,
|
||||
'company_id' => $company->id
|
||||
]);
|
||||
|
||||
factory(\App\Models\ClientContact::class, 1)->create([
|
||||
'user_id' => $user->id,
|
||||
'client_id' => $client->id,
|
||||
'company_id' => $company->id,
|
||||
'is_primary' => 1
|
||||
]);
|
||||
|
||||
factory(\App\Models\ClientContact::class, rand(1, 5))->create([
|
||||
'user_id' => $user->id,
|
||||
'client_id' => $client->id,
|
||||
'company_id' => $company->id
|
||||
]);
|
||||
|
||||
$client->id_number = $this->getNextClientNumber($client);
|
||||
|
||||
$settings = $client->settings;
|
||||
$settings->currency_id = (string)rand(1,79);
|
||||
$client->settings = $settings;
|
||||
|
||||
$country = Country::all()->random();
|
||||
|
||||
$client->country_id = $country->id;
|
||||
$client->save();
|
||||
|
||||
}
|
||||
|
||||
private function createExpense($client)
|
||||
{
|
||||
factory(\App\Models\Expense::class, rand(1, 5))->create([
|
||||
'user_id' => $client->user->id,
|
||||
'client_id' => $client->id,
|
||||
'company_id' => $client->company->id
|
||||
]);
|
||||
}
|
||||
|
||||
private function createVendor($client)
|
||||
{
|
||||
$vendor = factory(\App\Models\Vendor::class)->create([
|
||||
'user_id' => $client->user->id,
|
||||
'company_id' => $client->company->id
|
||||
]);
|
||||
|
||||
|
||||
factory(\App\Models\VendorContact::class, 1)->create([
|
||||
'user_id' => $client->user->id,
|
||||
'vendor_id' => $vendor->id,
|
||||
'company_id' => $client->company->id,
|
||||
'is_primary' => 1
|
||||
]);
|
||||
|
||||
factory(\App\Models\VendorContact::class, rand(1, 5))->create([
|
||||
'user_id' => $client->user->id,
|
||||
'vendor_id' => $vendor->id,
|
||||
'company_id' => $client->company->id,
|
||||
'is_primary' => 0
|
||||
]);
|
||||
}
|
||||
|
||||
private function createTask($client)
|
||||
{
|
||||
$vendor = factory(\App\Models\Task::class)->create([
|
||||
'user_id' => $client->user->id,
|
||||
'company_id' => $client->company->id
|
||||
]);
|
||||
}
|
||||
|
||||
private function createProject($client)
|
||||
{
|
||||
$vendor = factory(\App\Models\Project::class)->create([
|
||||
'user_id' => $client->user->id,
|
||||
'company_id' => $client->company->id
|
||||
]);
|
||||
}
|
||||
|
||||
private function createInvoice($client)
|
||||
{
|
||||
// for($x=0; $x<$this->count; $x++){
|
||||
// dispatch(new CreateTestInvoiceJob($client));
|
||||
// }
|
||||
|
||||
$faker = \Faker\Factory::create();
|
||||
|
||||
$invoice = InvoiceFactory::create($client->company->id, $client->user->id);//stub the company and user_id
|
||||
$invoice->client_id = $client->id;
|
||||
// $invoice->date = $faker->date();
|
||||
$dateable = Carbon::now()->subDays(rand(0, 90));
|
||||
$invoice->date = $dateable;
|
||||
|
||||
$invoice->line_items = $this->buildLineItems(rand(1, 10));
|
||||
$invoice->uses_inclusive_taxes = false;
|
||||
|
||||
if (rand(0, 1)) {
|
||||
$invoice->tax_name1 = 'GST';
|
||||
$invoice->tax_rate1 = 10.00;
|
||||
}
|
||||
|
||||
if (rand(0, 1)) {
|
||||
$invoice->tax_name2 = 'VAT';
|
||||
$invoice->tax_rate2 = 17.50;
|
||||
}
|
||||
|
||||
if (rand(0, 1)) {
|
||||
$invoice->tax_name3 = 'CA Sales Tax';
|
||||
$invoice->tax_rate3 = 5;
|
||||
}
|
||||
|
||||
$invoice->custom_value1 = $faker->date;
|
||||
$invoice->custom_value2 = rand(0, 1) ? 'yes' : 'no';
|
||||
|
||||
$invoice->save();
|
||||
|
||||
$invoice_calc = new InvoiceSum($invoice);
|
||||
$invoice_calc->build();
|
||||
|
||||
$invoice = $invoice_calc->getInvoice();
|
||||
|
||||
$invoice->save();
|
||||
$invoice->service()->createInvitations()->markSent();
|
||||
|
||||
$this->invoice_repo->markSent($invoice);
|
||||
|
||||
if (rand(0, 1)) {
|
||||
|
||||
$invoice = $invoice->service()->markPaid()->save();
|
||||
|
||||
}
|
||||
//@todo this slow things down, but gives us PDFs of the invoices for inspection whilst debugging.
|
||||
event(new InvoiceWasCreated($invoice, $invoice->company));
|
||||
}
|
||||
|
||||
private function createCredit($client)
|
||||
{
|
||||
// for($x=0; $x<$this->count; $x++){
|
||||
|
||||
// dispatch(new CreateTestCreditJob($client));
|
||||
|
||||
// }
|
||||
$faker = \Faker\Factory::create();
|
||||
|
||||
$credit = factory(\App\Models\Credit::class)->create(['user_id' => $client->user->id, 'company_id' => $client->company->id, 'client_id' => $client->id]);
|
||||
|
||||
$dateable = Carbon::now()->subDays(rand(0, 90));
|
||||
$credit->date = $dateable;
|
||||
|
||||
$credit->line_items = $this->buildLineItems(rand(1, 10));
|
||||
$credit->uses_inclusive_taxes = false;
|
||||
|
||||
if (rand(0, 1)) {
|
||||
$credit->tax_name1 = 'GST';
|
||||
$credit->tax_rate1 = 10.00;
|
||||
}
|
||||
|
||||
if (rand(0, 1)) {
|
||||
$credit->tax_name2 = 'VAT';
|
||||
$credit->tax_rate2 = 17.50;
|
||||
}
|
||||
|
||||
if (rand(0, 1)) {
|
||||
$credit->tax_name3 = 'CA Sales Tax';
|
||||
$credit->tax_rate3 = 5;
|
||||
}
|
||||
|
||||
$credit->save();
|
||||
|
||||
$invoice_calc = new InvoiceSum($credit);
|
||||
$invoice_calc->build();
|
||||
|
||||
$credit = $invoice_calc->getCredit();
|
||||
|
||||
$credit->save();
|
||||
$credit->service()->markSent()->save();
|
||||
$credit->service()->createInvitations();
|
||||
}
|
||||
|
||||
private function createQuote($client)
|
||||
{
|
||||
// for($x=0; $x<$this->count; $x++){
|
||||
|
||||
// dispatch(new CreateTestQuoteJob($client));
|
||||
// }
|
||||
$faker = \Faker\Factory::create();
|
||||
|
||||
//$quote = QuoteFactory::create($client->company->id, $client->user->id);//stub the company and user_id
|
||||
$quote =factory(\App\Models\Quote::class)->create(['user_id' => $client->user->id, 'company_id' => $client->company->id, 'client_id' => $client->id]);
|
||||
$quote->date = $faker->date();
|
||||
$quote->client_id = $client->id;
|
||||
|
||||
$quote->setRelation('client', $client);
|
||||
|
||||
$quote->line_items = $this->buildLineItems(rand(1, 10));
|
||||
$quote->uses_inclusive_taxes = false;
|
||||
|
||||
if (rand(0, 1)) {
|
||||
$quote->tax_name1 = 'GST';
|
||||
$quote->tax_rate1 = 10.00;
|
||||
}
|
||||
|
||||
if (rand(0, 1)) {
|
||||
$quote->tax_name2 = 'VAT';
|
||||
$quote->tax_rate2 = 17.50;
|
||||
}
|
||||
|
||||
if (rand(0, 1)) {
|
||||
$quote->tax_name3 = 'CA Sales Tax';
|
||||
$quote->tax_rate3 = 5;
|
||||
}
|
||||
|
||||
$quote->save();
|
||||
|
||||
$quote_calc = new InvoiceSum($quote);
|
||||
$quote_calc->build();
|
||||
|
||||
$quote = $quote_calc->getQuote();
|
||||
|
||||
$quote->save();
|
||||
|
||||
$quote->service()->markSent()->save();
|
||||
$quote->service()->createInvitations();
|
||||
}
|
||||
|
||||
private function buildLineItems($count = 1)
|
||||
{
|
||||
$line_items = [];
|
||||
|
||||
for ($x=0; $x<$count; $x++) {
|
||||
$item = InvoiceItemFactory::create();
|
||||
$item->quantity = 1;
|
||||
//$item->cost = 10;
|
||||
|
||||
if (rand(0, 1)) {
|
||||
$item->tax_name1 = 'GST';
|
||||
$item->tax_rate1 = 10.00;
|
||||
}
|
||||
|
||||
if (rand(0, 1)) {
|
||||
$item->tax_name1 = 'VAT';
|
||||
$item->tax_rate1 = 17.50;
|
||||
}
|
||||
|
||||
if (rand(0, 1)) {
|
||||
$item->tax_name1 = 'Sales Tax';
|
||||
$item->tax_rate1 = 5;
|
||||
}
|
||||
|
||||
$product = Product::all()->random();
|
||||
|
||||
$item->cost = (float)$product->cost;
|
||||
$item->product_key = $product->product_key;
|
||||
$item->notes = $product->notes;
|
||||
$item->custom_value1 = $product->custom_value1;
|
||||
$item->custom_value2 = $product->custom_value2;
|
||||
$item->custom_value3 = $product->custom_value3;
|
||||
$item->custom_value4 = $product->custom_value4;
|
||||
|
||||
|
||||
|
||||
$line_items[] = $item;
|
||||
}
|
||||
|
||||
return $line_items;
|
||||
}
|
||||
|
||||
private function warmCache()
|
||||
{
|
||||
/* Warm up the cache !*/
|
||||
$cached_tables = config('ninja.cached_tables');
|
||||
|
||||
foreach ($cached_tables as $name => $class) {
|
||||
if (! Cache::has($name)) {
|
||||
// check that the table exists in case the migration is pending
|
||||
if (! Schema::hasTable((new $class())->getTable())) {
|
||||
continue;
|
||||
}
|
||||
if ($name == 'payment_terms') {
|
||||
$orderBy = 'num_days';
|
||||
} elseif ($name == 'fonts') {
|
||||
$orderBy = 'sort_order';
|
||||
} elseif (in_array($name, ['currencies', 'industries', 'languages', 'countries', 'banks'])) {
|
||||
$orderBy = 'name';
|
||||
} else {
|
||||
$orderBy = 'id';
|
||||
}
|
||||
$tableData = $class::orderBy($orderBy)->get();
|
||||
if ($tableData->count()) {
|
||||
Cache::forever($name, $tableData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -12,6 +12,7 @@
|
||||
namespace App\Events\Client;
|
||||
|
||||
use App\Models\Client;
|
||||
use App\Models\Company;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
/**
|
||||
@ -26,13 +27,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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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');
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -19,15 +19,17 @@ use Illuminate\Queue\SerializesModels;
|
||||
class QuoteWasCreated
|
||||
{
|
||||
use SerializesModels;
|
||||
public $quote;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
4
app/Events/Vendor/VendorWasArchived.php
vendored
4
app/Events/Vendor/VendorWasArchived.php
vendored
@ -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;
|
||||
}
|
||||
}
|
||||
|
4
app/Events/Vendor/VendorWasCreated.php
vendored
4
app/Events/Vendor/VendorWasCreated.php
vendored
@ -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;
|
||||
}
|
||||
}
|
||||
|
4
app/Events/Vendor/VendorWasDeleted.php
vendored
4
app/Events/Vendor/VendorWasDeleted.php
vendored
@ -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;
|
||||
}
|
||||
}
|
||||
|
4
app/Events/Vendor/VendorWasRestored.php
vendored
4
app/Events/Vendor/VendorWasRestored.php
vendored
@ -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;
|
||||
}
|
||||
}
|
||||
|
4
app/Events/Vendor/VendorWasUpdated.php
vendored
4
app/Events/Vendor/VendorWasUpdated.php
vendored
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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'));
|
||||
|
@ -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})]);
|
||||
|
@ -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) {
|
||||
|
@ -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',
|
||||
|
@ -67,7 +67,7 @@ class TokenAuth
|
||||
//stateless, don't remember the user.
|
||||
auth()->login($user, false);
|
||||
|
||||
event(new UserLoggedIn($user));
|
||||
event(new UserLoggedIn($user, $company_token->company));
|
||||
} else {
|
||||
$error = [
|
||||
'message' => 'Invalid token',
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -347,6 +347,7 @@ class Import implements ShouldQueue
|
||||
$modified = $resource;
|
||||
$modified['company_id'] = $this->company->id;
|
||||
$modified['user_id'] = $this->processUserId($resource);
|
||||
$modified['balance'] = $modified['balance'] ?: 0;
|
||||
|
||||
unset($modified['id']);
|
||||
unset($modified['contacts']);
|
||||
|
@ -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 {
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
namespace App\Listeners\Activity;
|
||||
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Activity;
|
||||
use App\Repositories\ActivityRepository;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
@ -19,6 +20,7 @@ use Illuminate\Queue\InteractsWithQueue;
|
||||
class CreatedClientActivity implements ShouldQueue
|
||||
{
|
||||
protected $activity_repo;
|
||||
|
||||
/**
|
||||
* Create the event listener.
|
||||
*
|
||||
@ -37,6 +39,8 @@ class CreatedClientActivity implements ShouldQueue
|
||||
*/
|
||||
public function handle($event)
|
||||
{
|
||||
MultiDB::setDb($event->company->db);
|
||||
|
||||
$fields = new \stdClass;
|
||||
|
||||
$fields->client_id = $event->client->id;
|
||||
|
@ -12,6 +12,7 @@
|
||||
namespace App\Listeners\Activity;
|
||||
|
||||
use App\Jobs\Invoice\InvoiceWorkflowSettings;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Activity;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\Payment;
|
||||
@ -21,15 +22,15 @@ use Illuminate\Queue\InteractsWithQueue;
|
||||
|
||||
class PaymentCreatedActivity implements ShouldQueue
|
||||
{
|
||||
protected $activityRepo;
|
||||
protected $activity_repo;
|
||||
/**
|
||||
* Create the event listener.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(ActivityRepository $activityRepo)
|
||||
public function __construct(ActivityRepository $activity_repo)
|
||||
{
|
||||
$this->activityRepo = $activityRepo;
|
||||
$this->activity_repo = $activity_repo;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -40,6 +41,8 @@ class PaymentCreatedActivity implements ShouldQueue
|
||||
*/
|
||||
public function handle($event)
|
||||
{
|
||||
MultiDB::setDb($event->company->db);
|
||||
|
||||
$payment = $event->payment;
|
||||
|
||||
$invoices = $payment->invoices;
|
||||
@ -57,11 +60,11 @@ class PaymentCreatedActivity implements ShouldQueue
|
||||
|
||||
InvoiceWorkflowSettings::dispatchNow($invoice);
|
||||
|
||||
$this->activityRepo->save($fields, $invoice);
|
||||
$this->activity_repo->save($fields, $invoice);
|
||||
}
|
||||
|
||||
if (count($invoices) == 0) {
|
||||
$this->activityRepo->save($fields, $payment);
|
||||
$this->activity_repo->save($fields, $payment);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
namespace App\Listeners\Activity;
|
||||
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Activity;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\Payment;
|
||||
@ -20,15 +21,16 @@ use Illuminate\Queue\InteractsWithQueue;
|
||||
|
||||
class PaymentDeletedActivity implements ShouldQueue
|
||||
{
|
||||
protected $activityRepo;
|
||||
protected $activity_repo;
|
||||
|
||||
/**
|
||||
* Create the event listener.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(ActivityRepository $activityRepo)
|
||||
public function __construct(ActivityRepository $activity_repo)
|
||||
{
|
||||
$this->activityRepo = $activityRepo;
|
||||
$this->activity_repo = $activity_repo;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -39,6 +41,8 @@ class PaymentDeletedActivity implements ShouldQueue
|
||||
*/
|
||||
public function handle($event)
|
||||
{
|
||||
MultiDB::setDb($event->company->db);
|
||||
|
||||
$payment = $event->payment;
|
||||
|
||||
$invoices = $payment->invoices;
|
||||
@ -54,11 +58,11 @@ class PaymentDeletedActivity implements ShouldQueue
|
||||
foreach ($invoices as $invoice) { //todo we may need to add additional logic if in the future we apply payments to other entity Types, not just invoices
|
||||
$fields->invoice_id = $invoice->id;
|
||||
|
||||
$this->activityRepo->save($fields, $invoice);
|
||||
$this->activity_repo->save($fields, $invoice);
|
||||
}
|
||||
|
||||
if (count($invoices) == 0) {
|
||||
$this->activityRepo->save($fields, $payment);
|
||||
$this->activity_repo->save($fields, $payment);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
namespace App\Listeners\Activity;
|
||||
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Activity;
|
||||
use App\Repositories\ActivityRepository;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
@ -37,6 +38,8 @@ class PaymentRefundedActivity implements ShouldQueue
|
||||
*/
|
||||
public function handle($event)
|
||||
{
|
||||
MultiDB::setDb($event->company->db);
|
||||
|
||||
$fields = new \stdClass;
|
||||
|
||||
$fields->client_id = $event->payment->id;
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
namespace App\Listeners\Activity;
|
||||
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Activity;
|
||||
use App\Repositories\ActivityRepository;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
@ -19,6 +20,7 @@ use Illuminate\Queue\InteractsWithQueue;
|
||||
class PaymentVoidedActivity implements ShouldQueue
|
||||
{
|
||||
protected $activity_repo;
|
||||
|
||||
/**
|
||||
* Create the event listener.
|
||||
*
|
||||
@ -37,6 +39,8 @@ class PaymentVoidedActivity implements ShouldQueue
|
||||
*/
|
||||
public function handle($event)
|
||||
{
|
||||
MultiDB::setDb($event->company->db);
|
||||
|
||||
$fields = new \stdClass;
|
||||
|
||||
$fields->client_id = $event->payment->id;
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
namespace App\Listeners\Contact;
|
||||
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Activity;
|
||||
use App\Repositories\ActivityRepository;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
@ -35,6 +36,8 @@ class UpdateContactLastLogin implements ShouldQueue
|
||||
*/
|
||||
public function handle($event)
|
||||
{
|
||||
MultiDB::setDb($event->company->db);
|
||||
|
||||
$client_contact = $event->client_contact;
|
||||
|
||||
$client_contact->last_login = now();
|
||||
|
@ -13,6 +13,7 @@ namespace App\Listeners\Credit;
|
||||
|
||||
use App\Factory\CreditInvitationFactory;
|
||||
use App\Factory\InvoiceInvitationFactory;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\CreditInvitation;
|
||||
use App\Models\InvoiceInvitation;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
@ -34,6 +35,8 @@ class CreateCreditInvitation implements ShouldQueue
|
||||
*/
|
||||
public function handle($event)
|
||||
{
|
||||
MultiDB::setDb($event->company->db);
|
||||
|
||||
$credit = $event->credit;
|
||||
|
||||
$contacts = $credit->client->contacts;
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace App\Listeners\Document;
|
||||
|
||||
use App\Events\Company\CompanyWasDeleted;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Document;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
@ -29,6 +30,9 @@ class DeleteCompanyDocuments
|
||||
*/
|
||||
public function handle(CompanyWasDeleted $event)
|
||||
{
|
||||
|
||||
MultiDB::setDb($event->company->db);
|
||||
|
||||
$path = sprintf('%s/%s', storage_path('app/public'), $event->company->company_key);
|
||||
|
||||
// Remove all files & folders, under company's path.
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
namespace App\Listeners\Invoice;
|
||||
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Activity;
|
||||
use App\Models\ClientContact;
|
||||
use App\Models\InvoiceInvitation;
|
||||
@ -41,6 +42,8 @@ class CreateInvoiceActivity implements ShouldQueue
|
||||
*/
|
||||
public function handle($event)
|
||||
{
|
||||
MultiDB::setDb($event->company->db);
|
||||
|
||||
$fields = new \stdClass;
|
||||
|
||||
$fields->invoice_id = $event->invoice->id;
|
||||
|
@ -12,6 +12,7 @@
|
||||
namespace App\Listeners\Invoice;
|
||||
|
||||
use App\Factory\InvoiceInvitationFactory;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\InvoiceInvitation;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
@ -32,6 +33,8 @@ class CreateInvoiceInvitation implements ShouldQueue
|
||||
*/
|
||||
public function handle($event)
|
||||
{
|
||||
MultiDB::setDb($event->company->db);
|
||||
|
||||
$invoice = $event->invoice;
|
||||
|
||||
$contacts = $invoice->client->contacts;
|
||||
|
@ -12,6 +12,7 @@
|
||||
namespace App\Listeners\Invoice;
|
||||
|
||||
use App\Jobs\Invoice\CreateInvoicePdf as PdfCreator;
|
||||
use App\Libraries\MultiDB;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
|
||||
@ -35,6 +36,9 @@ class CreateInvoicePdf implements ShouldQueue
|
||||
*/
|
||||
public function handle($event)
|
||||
{
|
||||
|
||||
MultiDB::setDb($event->company->db);
|
||||
|
||||
$event->invoice->invitations->each(function ($invitation) {
|
||||
|
||||
PdfCreator::dispatch($invitation);
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
namespace App\Listeners\Invoice;
|
||||
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Activity;
|
||||
use App\Models\ClientContact;
|
||||
use App\Models\InvoiceInvitation;
|
||||
@ -41,6 +42,9 @@ class InvoiceCancelledActivity implements ShouldQueue
|
||||
*/
|
||||
public function handle($event)
|
||||
{
|
||||
|
||||
MultiDB::setDb($event->company->db);
|
||||
|
||||
$fields = new \stdClass;
|
||||
|
||||
$fields->invoice_id = $event->invoice->id;
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
namespace App\Listeners\Invoice;
|
||||
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Activity;
|
||||
use App\Models\ClientContact;
|
||||
use App\Models\InvoiceInvitation;
|
||||
@ -41,6 +42,9 @@ class InvoiceDeletedActivity implements ShouldQueue
|
||||
*/
|
||||
public function handle($event)
|
||||
{
|
||||
|
||||
MultiDB::setDb($event->company->db);
|
||||
|
||||
$fields = new \stdClass;
|
||||
|
||||
$fields->invoice_id = $event->invoice->id;
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
namespace App\Listeners\Invoice;
|
||||
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Activity;
|
||||
use App\Models\ClientContact;
|
||||
use App\Models\InvoiceInvitation;
|
||||
@ -41,6 +42,8 @@ class InvoiceEmailActivity implements ShouldQueue
|
||||
*/
|
||||
public function handle($event)
|
||||
{
|
||||
MultiDB::setDb($event->company->db);
|
||||
|
||||
$fields = new \stdClass;
|
||||
|
||||
$fields->invoice_id = $event->invitation->invoice->id;
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
namespace App\Listeners\Invoice;
|
||||
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Activity;
|
||||
use App\Models\ClientContact;
|
||||
use App\Models\InvoiceInvitation;
|
||||
@ -41,6 +42,8 @@ class InvoiceEmailFailedActivity implements ShouldQueue
|
||||
*/
|
||||
public function handle($event)
|
||||
{
|
||||
MultiDB::setDb($event->company->db);
|
||||
|
||||
$fields = new \stdClass;
|
||||
|
||||
$fields->invoice_id = $event->invoice->id;
|
||||
|
@ -12,6 +12,7 @@
|
||||
namespace App\Listeners\Invoice;
|
||||
|
||||
use App\Jobs\Mail\EntitySentMailer;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Activity;
|
||||
use App\Models\ClientContact;
|
||||
use App\Models\InvoiceInvitation;
|
||||
@ -41,7 +42,8 @@ class InvoiceEmailedNotification implements ShouldQueue
|
||||
*/
|
||||
public function handle($event)
|
||||
{
|
||||
$invitation = $event->invitation;
|
||||
MultiDB::setDb($event->company->db);
|
||||
|
||||
|
||||
foreach ($invitation->company->company_users as $company_user) {
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
namespace App\Listeners\Invoice;
|
||||
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Activity;
|
||||
use App\Models\ClientContact;
|
||||
use App\Models\InvoiceInvitation;
|
||||
@ -41,6 +42,8 @@ class InvoiceReversedActivity implements ShouldQueue
|
||||
*/
|
||||
public function handle($event)
|
||||
{
|
||||
MultiDB::setDb($event->company->db);
|
||||
|
||||
$fields = new \stdClass;
|
||||
|
||||
$fields->invoice_id = $event->invoice->id;
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
namespace App\Listeners\Invoice;
|
||||
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Invoice;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
@ -35,6 +36,8 @@ class UpdateInvoiceInvitations implements ShouldQueue
|
||||
*/
|
||||
public function handle($event)
|
||||
{
|
||||
MultiDB::setDb($event->company->db);
|
||||
|
||||
$payment = $event->payment;
|
||||
$invoices = $payment->invoices;
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
namespace App\Listeners\Misc;
|
||||
|
||||
use App\Jobs\Mail\EntityViewedMailer;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Notifications\Admin\EntityViewedNotification;
|
||||
use App\Utils\Traits\Notifications\UserNotifies;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
@ -39,6 +40,8 @@ class InvitationViewedListener implements ShouldQueue
|
||||
*/
|
||||
public function handle($event)
|
||||
{
|
||||
MultiDB::setDb($event->company->db);
|
||||
|
||||
$entity_name = $event->entity;
|
||||
$invitation = $event->invitation;
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
namespace App\Listeners\Payment;
|
||||
|
||||
use App\Jobs\Mail\EntityPaidMailer;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Activity;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\Payment;
|
||||
@ -43,6 +44,8 @@ class PaymentNotification implements ShouldQueue
|
||||
*/
|
||||
public function handle($event)
|
||||
{
|
||||
MultiDB::setDb($event->company->db);
|
||||
|
||||
$payment = $event->payment;
|
||||
|
||||
/*User notifications*/
|
||||
|
@ -14,6 +14,7 @@ namespace App\Listeners\Quote;
|
||||
use App\Factory\CreditInvitationFactory;
|
||||
use App\Factory\InvoiceInvitationFactory;
|
||||
use App\Factory\QuoteInvitationFactory;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\InvoiceInvitation;
|
||||
use App\Models\QuoteInvitation;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
@ -35,6 +36,8 @@ class CreateQuoteInvitation implements ShouldQueue
|
||||
*/
|
||||
public function handle($event)
|
||||
{
|
||||
MultiDB::setDb($event->company->db);
|
||||
|
||||
$quote = $event->credit;
|
||||
|
||||
$contacts = $quote->client->contacts;
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace App\Listeners\Quote;
|
||||
|
||||
use App\Jobs\Quote\QuoteWorkflowSettings;
|
||||
use App\Libraries\MultiDB;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
|
||||
@ -26,6 +27,8 @@ class ReachWorkflowSettings
|
||||
*/
|
||||
public function handle($event)
|
||||
{
|
||||
MultiDB::setDb($event->company->db);
|
||||
|
||||
QuoteWorkflowSettings::dispatchNow($event->quote);
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
namespace App\Listeners\User;
|
||||
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Activity;
|
||||
use App\Repositories\ActivityRepository;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
@ -37,6 +38,8 @@ class ArchivedUserActivity implements ShouldQueue
|
||||
*/
|
||||
public function handle($event)
|
||||
{
|
||||
MultiDB::setDb($event->company->db);
|
||||
|
||||
$fields = new \stdClass;
|
||||
|
||||
if (auth()->user()->id) {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user