mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01:00
Add event listeners for Subscriptions + fix user actioning the event()
This commit is contained in:
parent
9222b72c7e
commit
7e3a9205b9
47
app/Events/Subscription/SubscriptionWasArchived.php
Normal file
47
app/Events/Subscription/SubscriptionWasArchived.php
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Invoice Ninja (https://invoiceninja.com).
|
||||||
|
*
|
||||||
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @license https://opensource.org/licenses/AAL
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Events\Subscription;
|
||||||
|
|
||||||
|
use App\Models\Company;
|
||||||
|
use App\Models\Subscription;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class SubscriptionWasArchived.
|
||||||
|
*/
|
||||||
|
class SubscriptionWasArchived
|
||||||
|
{
|
||||||
|
use SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Subscription
|
||||||
|
*/
|
||||||
|
public $subscription;
|
||||||
|
|
||||||
|
public $company;
|
||||||
|
|
||||||
|
public $event_vars;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new event instance.
|
||||||
|
*
|
||||||
|
* @param Subscription $subscription
|
||||||
|
* @param Company $company
|
||||||
|
* @param array $event_vars
|
||||||
|
*/
|
||||||
|
public function __construct(Subscription $subscription, Company $company, array $event_vars)
|
||||||
|
{
|
||||||
|
$this->task = $subscription;
|
||||||
|
$this->company = $company;
|
||||||
|
$this->event_vars = $event_vars;
|
||||||
|
}
|
||||||
|
}
|
47
app/Events/Subscription/SubscriptionWasDeleted.php
Normal file
47
app/Events/Subscription/SubscriptionWasDeleted.php
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Invoice Ninja (https://invoiceninja.com).
|
||||||
|
*
|
||||||
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @license https://opensource.org/licenses/AAL
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Events\Subscription;
|
||||||
|
|
||||||
|
use App\Models\Company;
|
||||||
|
use App\Models\Subscription;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class SubscriptionWasDeleted.
|
||||||
|
*/
|
||||||
|
class SubscriptionWasDeleted
|
||||||
|
{
|
||||||
|
use SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Subscription
|
||||||
|
*/
|
||||||
|
public $subscription;
|
||||||
|
|
||||||
|
public $company;
|
||||||
|
|
||||||
|
public $event_vars;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new event instance.
|
||||||
|
*
|
||||||
|
* @param Subscription $subscription
|
||||||
|
* @param Company $company
|
||||||
|
* @param array $event_vars
|
||||||
|
*/
|
||||||
|
public function __construct(Subscription $subscription, Company $company, array $event_vars)
|
||||||
|
{
|
||||||
|
$this->task = $subscription;
|
||||||
|
$this->company = $company;
|
||||||
|
$this->event_vars = $event_vars;
|
||||||
|
}
|
||||||
|
}
|
49
app/Events/Subscription/SubscriptionWasRestored.php
Normal file
49
app/Events/Subscription/SubscriptionWasRestored.php
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Invoice Ninja (https://invoiceninja.com).
|
||||||
|
*
|
||||||
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @license https://opensource.org/licenses/AAL
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Events\Subscription;
|
||||||
|
|
||||||
|
use App\Models\Company;
|
||||||
|
use App\Models\Subscription;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class SubscriptionWasRestored.
|
||||||
|
*/
|
||||||
|
class SubscriptionWasRestored
|
||||||
|
{
|
||||||
|
use SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Subscription
|
||||||
|
*/
|
||||||
|
public $subscription;
|
||||||
|
|
||||||
|
public $company;
|
||||||
|
|
||||||
|
public $event_vars;
|
||||||
|
|
||||||
|
public $fromDeleted;
|
||||||
|
/**
|
||||||
|
* Create a new event instance.
|
||||||
|
*
|
||||||
|
* @param Subscription $subscription
|
||||||
|
* @param Company $company
|
||||||
|
* @param array $event_vars
|
||||||
|
*/
|
||||||
|
public function __construct(Subscription $subscription, $fromDeleted, Company $company, array $event_vars)
|
||||||
|
{
|
||||||
|
$this->task = $subscription;
|
||||||
|
$this->fromDeleted = $fromDeleted;
|
||||||
|
$this->company = $company;
|
||||||
|
$this->event_vars = $event_vars;
|
||||||
|
}
|
||||||
|
}
|
47
app/Events/Subscription/SubscriptionWasUpdated.php
Normal file
47
app/Events/Subscription/SubscriptionWasUpdated.php
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Invoice Ninja (https://invoiceninja.com).
|
||||||
|
*
|
||||||
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @license https://opensource.org/licenses/AAL
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Events\Subscription;
|
||||||
|
|
||||||
|
use App\Models\Company;
|
||||||
|
use App\Models\Subscription;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class SubscriptionWasUpdated.
|
||||||
|
*/
|
||||||
|
class SubscriptionWasUpdated
|
||||||
|
{
|
||||||
|
use SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Subscription
|
||||||
|
*/
|
||||||
|
public $subscription;
|
||||||
|
|
||||||
|
public $company;
|
||||||
|
|
||||||
|
public $event_vars;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new event instance.
|
||||||
|
*
|
||||||
|
* @param Subscription $subscription
|
||||||
|
* @param Company $company
|
||||||
|
* @param array $event_vars
|
||||||
|
*/
|
||||||
|
public function __construct(Subscription $subscription, Company $company, array $event_vars)
|
||||||
|
{
|
||||||
|
$this->task = $subscription;
|
||||||
|
$this->company = $company;
|
||||||
|
$this->event_vars = $event_vars;
|
||||||
|
}
|
||||||
|
}
|
@ -282,7 +282,7 @@ class ClientController extends BaseController
|
|||||||
|
|
||||||
$this->uploadLogo($request->file('company_logo'), $client->company, $client);
|
$this->uploadLogo($request->file('company_logo'), $client->company, $client);
|
||||||
|
|
||||||
event(new ClientWasUpdated($client, $client->company, Ninja::eventVars()));
|
event(new ClientWasUpdated($client, $client->company, Ninja::eventVars(auth()->user()->id)));
|
||||||
|
|
||||||
return $this->itemResponse($client->fresh());
|
return $this->itemResponse($client->fresh());
|
||||||
}
|
}
|
||||||
@ -380,7 +380,7 @@ class ClientController extends BaseController
|
|||||||
|
|
||||||
$this->uploadLogo($request->file('company_logo'), $client->company, $client);
|
$this->uploadLogo($request->file('company_logo'), $client->company, $client);
|
||||||
|
|
||||||
event(new ClientWasCreated($client, $client->company, Ninja::eventVars()));
|
event(new ClientWasCreated($client, $client->company, Ninja::eventVars(auth()->user()->id)));
|
||||||
|
|
||||||
return $this->itemResponse($client);
|
return $this->itemResponse($client);
|
||||||
}
|
}
|
||||||
|
@ -148,7 +148,7 @@ class PaymentMethodController extends Controller
|
|||||||
->detach($payment_method);
|
->detach($payment_method);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
event(new MethodDeleted($payment_method, auth('contact')->user()->company, Ninja::eventVars()));
|
event(new MethodDeleted($payment_method, auth('contact')->user()->company, Ninja::eventVars(auth('contact')->user()->id)));
|
||||||
$payment_method->delete();
|
$payment_method->delete();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
|
||||||
|
@ -173,7 +173,7 @@ class ClientSubscriptionController extends BaseController
|
|||||||
{
|
{
|
||||||
$client_subscription = $this->client_subscription_repo->save($request->all(), ClientSubscriptionFactory::create(auth()->user()->company()->id, auth()->user()->id));
|
$client_subscription = $this->client_subscription_repo->save($request->all(), ClientSubscriptionFactory::create(auth()->user()->company()->id, auth()->user()->id));
|
||||||
|
|
||||||
event(new ClientsubscriptionWasCreated($client_subscription, $client_subscription->company, Ninja::eventVars()));
|
event(new ClientsubscriptionWasCreated($client_subscription, $client_subscription->company, Ninja::eventVars(auth()->user()->id)));
|
||||||
|
|
||||||
return $this->itemResponse($client_subscription);
|
return $this->itemResponse($client_subscription);
|
||||||
}
|
}
|
||||||
|
@ -201,7 +201,7 @@ class CreditController extends BaseController
|
|||||||
->fillDefaults()
|
->fillDefaults()
|
||||||
->save();
|
->save();
|
||||||
|
|
||||||
event(new CreditWasCreated($credit, $credit->company, Ninja::eventVars()));
|
event(new CreditWasCreated($credit, $credit->company, Ninja::eventVars(auth()->user()->id)));
|
||||||
|
|
||||||
return $this->itemResponse($credit);
|
return $this->itemResponse($credit);
|
||||||
}
|
}
|
||||||
@ -378,7 +378,7 @@ class CreditController extends BaseController
|
|||||||
|
|
||||||
$credit->service()->deletePdf();
|
$credit->service()->deletePdf();
|
||||||
|
|
||||||
event(new CreditWasUpdated($credit, $credit->company, Ninja::eventVars()));
|
event(new CreditWasUpdated($credit, $credit->company, Ninja::eventVars(auth()->user()->id)));
|
||||||
|
|
||||||
return $this->itemResponse($credit);
|
return $this->itemResponse($credit);
|
||||||
}
|
}
|
||||||
|
@ -157,7 +157,7 @@ class EmailController extends BaseController
|
|||||||
$this->entity_transformer = QuoteTransformer::class;
|
$this->entity_transformer = QuoteTransformer::class;
|
||||||
|
|
||||||
if ($entity_obj->invitations->count() >= 1)
|
if ($entity_obj->invitations->count() >= 1)
|
||||||
event(new QuoteWasEmailed($entity_obj->invitations->first(), $entity_obj->company, Ninja::eventVars(), 'quote'));
|
event(new QuoteWasEmailed($entity_obj->invitations->first(), $entity_obj->company, Ninja::eventVars(auth()->user()->id), 'quote'));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,7 +166,7 @@ class EmailController extends BaseController
|
|||||||
$this->entity_transformer = CreditTransformer::class;
|
$this->entity_transformer = CreditTransformer::class;
|
||||||
|
|
||||||
if ($entity_obj->invitations->count() >= 1)
|
if ($entity_obj->invitations->count() >= 1)
|
||||||
event(new CreditWasEmailed($entity_obj->invitations->first(), $entity_obj->company, Ninja::eventVars(), 'credit'));
|
event(new CreditWasEmailed($entity_obj->invitations->first(), $entity_obj->company, Ninja::eventVars(auth()->user()->id), 'credit'));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,7 +279,7 @@ class ExpenseController extends BaseController
|
|||||||
|
|
||||||
$this->uploadLogo($request->file('company_logo'), $expense->company, $expense);
|
$this->uploadLogo($request->file('company_logo'), $expense->company, $expense);
|
||||||
|
|
||||||
event(new ExpenseWasUpdated($expense, $expense->company, Ninja::eventVars()));
|
event(new ExpenseWasUpdated($expense, $expense->company, Ninja::eventVars(auth()->user()->id)));
|
||||||
|
|
||||||
return $this->itemResponse($expense->fresh());
|
return $this->itemResponse($expense->fresh());
|
||||||
}
|
}
|
||||||
@ -373,7 +373,7 @@ class ExpenseController extends BaseController
|
|||||||
{
|
{
|
||||||
$expense = $this->expense_repo->save($request->all(), ExpenseFactory::create(auth()->user()->company()->id, auth()->user()->id));
|
$expense = $this->expense_repo->save($request->all(), ExpenseFactory::create(auth()->user()->company()->id, auth()->user()->id));
|
||||||
|
|
||||||
event(new ExpenseWasCreated($expense, $expense->company, Ninja::eventVars()));
|
event(new ExpenseWasCreated($expense, $expense->company, Ninja::eventVars(auth()->user()->id)));
|
||||||
|
|
||||||
return $this->itemResponse($expense);
|
return $this->itemResponse($expense);
|
||||||
}
|
}
|
||||||
|
@ -218,7 +218,7 @@ class InvoiceController extends BaseController
|
|||||||
->triggeredActions($request)
|
->triggeredActions($request)
|
||||||
->save();
|
->save();
|
||||||
|
|
||||||
event(new InvoiceWasCreated($invoice, $invoice->company, Ninja::eventVars()));
|
event(new InvoiceWasCreated($invoice, $invoice->company, Ninja::eventVars(auth()->user()->id)));
|
||||||
|
|
||||||
return $this->itemResponse($invoice);
|
return $this->itemResponse($invoice);
|
||||||
}
|
}
|
||||||
@ -399,7 +399,7 @@ class InvoiceController extends BaseController
|
|||||||
|
|
||||||
$invoice->service()->deletePdf();
|
$invoice->service()->deletePdf();
|
||||||
|
|
||||||
event(new InvoiceWasUpdated($invoice, $invoice->company, Ninja::eventVars()));
|
event(new InvoiceWasUpdated($invoice, $invoice->company, Ninja::eventVars(auth()->user()->id)));
|
||||||
|
|
||||||
return $this->itemResponse($invoice);
|
return $this->itemResponse($invoice);
|
||||||
}
|
}
|
||||||
|
@ -382,7 +382,7 @@ class PaymentController extends BaseController
|
|||||||
|
|
||||||
$payment = $this->payment_repo->save($request->all(), $payment);
|
$payment = $this->payment_repo->save($request->all(), $payment);
|
||||||
|
|
||||||
event(new PaymentWasUpdated($payment, $payment->company, Ninja::eventVars()));
|
event(new PaymentWasUpdated($payment, $payment->company, Ninja::eventVars(auth()->user()->id)));
|
||||||
return $this->itemResponse($payment);
|
return $this->itemResponse($payment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ class QuoteController extends BaseController
|
|||||||
|
|
||||||
$quote = $quote->service()->fillDefaults()->save();
|
$quote = $quote->service()->fillDefaults()->save();
|
||||||
|
|
||||||
event(new QuoteWasCreated($quote, $quote->company, Ninja::eventVars()));
|
event(new QuoteWasCreated($quote, $quote->company, Ninja::eventVars(auth()->user()->id)));
|
||||||
|
|
||||||
return $this->itemResponse($quote);
|
return $this->itemResponse($quote);
|
||||||
}
|
}
|
||||||
@ -389,7 +389,7 @@ class QuoteController extends BaseController
|
|||||||
|
|
||||||
$quote->service()->deletePdf();
|
$quote->service()->deletePdf();
|
||||||
|
|
||||||
event(new QuoteWasUpdated($quote, $quote->company, Ninja::eventVars()));
|
event(new QuoteWasUpdated($quote, $quote->company, Ninja::eventVars(auth()->user()->id)));
|
||||||
|
|
||||||
return $this->itemResponse($quote);
|
return $this->itemResponse($quote);
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ class ClientController extends BaseController
|
|||||||
|
|
||||||
$this->uploadLogo($request->file('company_logo'), $company, $client);
|
$this->uploadLogo($request->file('company_logo'), $company, $client);
|
||||||
|
|
||||||
event(new ClientWasCreated($client, $company, Ninja::eventVars()));
|
event(new ClientWasCreated($client, $company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||||
|
|
||||||
return $this->itemResponse($client);
|
return $this->itemResponse($client);
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ class InvoiceController extends BaseController
|
|||||||
|
|
||||||
$invoice = $invoice->service()->triggeredActions($request)->save();
|
$invoice = $invoice->service()->triggeredActions($request)->save();
|
||||||
|
|
||||||
event(new InvoiceWasCreated($invoice, $company, Ninja::eventVars()));
|
event(new InvoiceWasCreated($invoice, $company, Ninja::eventVars(auth()->user()->id)));
|
||||||
|
|
||||||
return $this->itemResponse($invoice);
|
return $this->itemResponse($invoice);
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Events\Subscription\SubscriptionWasCreated;
|
use App\Events\Subscription\SubscriptionWasCreated;
|
||||||
|
use App\Events\Subscription\SubscriptionWasUpdated;
|
||||||
use App\Factory\SubscriptionFactory;
|
use App\Factory\SubscriptionFactory;
|
||||||
use App\Http\Requests\Subscription\CreateSubscriptionRequest;
|
use App\Http\Requests\Subscription\CreateSubscriptionRequest;
|
||||||
use App\Http\Requests\Subscription\DestroySubscriptionRequest;
|
use App\Http\Requests\Subscription\DestroySubscriptionRequest;
|
||||||
@ -176,7 +177,7 @@ class SubscriptionController extends BaseController
|
|||||||
{
|
{
|
||||||
$subscription = $this->subscription_repo->save($request->all(), SubscriptionFactory::create(auth()->user()->company()->id, auth()->user()->id));
|
$subscription = $this->subscription_repo->save($request->all(), SubscriptionFactory::create(auth()->user()->company()->id, auth()->user()->id));
|
||||||
|
|
||||||
event(new SubscriptionWasCreated($subscription, $subscription->company, Ninja::eventVars()));
|
event(new SubscriptionWasCreated($subscription, $subscription->company, Ninja::eventVars(auth()->user()->id)));
|
||||||
|
|
||||||
return $this->itemResponse($subscription);
|
return $this->itemResponse($subscription);
|
||||||
}
|
}
|
||||||
@ -351,6 +352,8 @@ class SubscriptionController extends BaseController
|
|||||||
|
|
||||||
$subscription = $this->subscription_repo->save($request->all(), $subscription);
|
$subscription = $this->subscription_repo->save($request->all(), $subscription);
|
||||||
|
|
||||||
|
event(new SubscriptionWasUpdated($subscription, $subscription->company, Ninja::eventVars(auth()->user()->id)));
|
||||||
|
|
||||||
return $this->itemResponse($subscription);
|
return $this->itemResponse($subscription);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,7 +282,7 @@ class TaskController extends BaseController
|
|||||||
if($task->status_order != $old_task->status_order)
|
if($task->status_order != $old_task->status_order)
|
||||||
$this->task_repo->sortStatuses($old_task, $task);
|
$this->task_repo->sortStatuses($old_task, $task);
|
||||||
|
|
||||||
event(new TaskWasUpdated($task, $task->company, Ninja::eventVars()));
|
event(new TaskWasUpdated($task, $task->company, Ninja::eventVars(auth()->user()->id)));
|
||||||
|
|
||||||
return $this->itemResponse($task->fresh());
|
return $this->itemResponse($task->fresh());
|
||||||
}
|
}
|
||||||
@ -376,7 +376,7 @@ class TaskController extends BaseController
|
|||||||
{
|
{
|
||||||
$task = $this->task_repo->save($request->all(), TaskFactory::create(auth()->user()->company()->id, auth()->user()->id));
|
$task = $this->task_repo->save($request->all(), TaskFactory::create(auth()->user()->company()->id, auth()->user()->id));
|
||||||
|
|
||||||
event(new TaskWasCreated($task, $task->company, Ninja::eventVars()));
|
event(new TaskWasCreated($task, $task->company, Ninja::eventVars(auth()->user()->id)));
|
||||||
|
|
||||||
return $this->itemResponse($task);
|
return $this->itemResponse($task);
|
||||||
}
|
}
|
||||||
|
@ -211,7 +211,7 @@ class UserController extends BaseController
|
|||||||
|
|
||||||
nlog("in the store method of the usercontroller class");
|
nlog("in the store method of the usercontroller class");
|
||||||
|
|
||||||
event(new UserWasCreated($user, auth()->user(), $company, Ninja::eventVars()));
|
event(new UserWasCreated($user, auth()->user(), $company, Ninja::eventVars(auth()->user()->id)));
|
||||||
|
|
||||||
return $this->itemResponse($user->fresh());
|
return $this->itemResponse($user->fresh());
|
||||||
}
|
}
|
||||||
@ -401,7 +401,7 @@ class UserController extends BaseController
|
|||||||
$user->company_user()->update(["permissions_updated_at" => now()]);
|
$user->company_user()->update(["permissions_updated_at" => now()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
event(new UserWasUpdated($user, auth()->user(), auth()->user()->company, Ninja::eventVars()));
|
event(new UserWasUpdated($user, auth()->user(), auth()->user()->company, Ninja::eventVars(auth()->user()->id)));
|
||||||
|
|
||||||
return $this->itemResponse($user);
|
return $this->itemResponse($user);
|
||||||
}
|
}
|
||||||
@ -474,7 +474,7 @@ class UserController extends BaseController
|
|||||||
/* If the user passes the company user we archive the company user */
|
/* If the user passes the company user we archive the company user */
|
||||||
$user = $this->user_repo->delete($request->all(), $user);
|
$user = $this->user_repo->delete($request->all(), $user);
|
||||||
|
|
||||||
event(new UserWasDeleted($user, auth()->user(), auth()->user()->company, Ninja::eventVars()));
|
event(new UserWasDeleted($user, auth()->user(), auth()->user()->company, Ninja::eventVars(auth()->user()->id)));
|
||||||
|
|
||||||
return $this->itemResponse($user->fresh());
|
return $this->itemResponse($user->fresh());
|
||||||
}
|
}
|
||||||
|
@ -278,7 +278,7 @@ class VendorController extends BaseController
|
|||||||
|
|
||||||
$this->uploadLogo($request->file('company_logo'), $vendor->company, $vendor);
|
$this->uploadLogo($request->file('company_logo'), $vendor->company, $vendor);
|
||||||
|
|
||||||
event(new VendorWasUpdated($vendor, $vendor->company, Ninja::eventVars()));
|
event(new VendorWasUpdated($vendor, $vendor->company, Ninja::eventVars(auth()->user()->id)));
|
||||||
|
|
||||||
return $this->itemResponse($vendor->fresh());
|
return $this->itemResponse($vendor->fresh());
|
||||||
}
|
}
|
||||||
@ -376,7 +376,7 @@ class VendorController extends BaseController
|
|||||||
|
|
||||||
$this->uploadLogo($request->file('company_logo'), $vendor->company, $vendor);
|
$this->uploadLogo($request->file('company_logo'), $vendor->company, $vendor);
|
||||||
|
|
||||||
event(new VendorWasCreated($vendor, $vendor->company, Ninja::eventVars()));
|
event(new VendorWasCreated($vendor, $vendor->company, Ninja::eventVars(auth()->user()->id)));
|
||||||
|
|
||||||
return $this->itemResponse($vendor);
|
return $this->itemResponse($vendor);
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ class EmailEntity implements ShouldQueue
|
|||||||
{
|
{
|
||||||
switch ($this->entity_string) {
|
switch ($this->entity_string) {
|
||||||
case 'invoice':
|
case 'invoice':
|
||||||
event(new InvoiceWasEmailedAndFailed($this->invitation, $this->company, $message, $this->reminder_template, Ninja::eventVars()));
|
event(new InvoiceWasEmailedAndFailed($this->invitation, $this->company, $message, $this->reminder_template, Ninja::eventVars(auth()->user()->id)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -105,10 +105,10 @@ class NinjaMailerJob implements ShouldQueue
|
|||||||
|
|
||||||
switch ($class) {
|
switch ($class) {
|
||||||
case Invoice::class:
|
case Invoice::class:
|
||||||
event(new InvoiceWasEmailedAndFailed($this->nmo->invitation, $this->nmo->company, $message, $this->nmo->reminder_template, Ninja::eventVars()));
|
event(new InvoiceWasEmailedAndFailed($this->nmo->invitation, $this->nmo->company, $message, $this->nmo->reminder_template, Ninja::eventVars(auth()->user()->id)));
|
||||||
break;
|
break;
|
||||||
case Payment::class:
|
case Payment::class:
|
||||||
event(new PaymentWasEmailedAndFailed($this->nmo->entity, $this->nmo->company, $message, Ninja::eventVars()));
|
event(new PaymentWasEmailedAndFailed($this->nmo->entity, $this->nmo->company, $message, Ninja::eventVars(auth()->user()->id)));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
# code...
|
# code...
|
||||||
|
@ -91,7 +91,7 @@ class EmailPayment implements ShouldQueue
|
|||||||
|
|
||||||
NinjaMailerJob::dispatch($nmo);
|
NinjaMailerJob::dispatch($nmo);
|
||||||
|
|
||||||
event(new PaymentWasEmailed($this->payment, $this->payment->company, Ninja::eventVars()));
|
event(new PaymentWasEmailed($this->payment, $this->payment->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ class CreateUser
|
|||||||
|
|
||||||
if(!Ninja::isSelfHost()){
|
if(!Ninja::isSelfHost()){
|
||||||
nlog("in the create user class");
|
nlog("in the create user class");
|
||||||
event(new UserWasCreated($user, $user, $this->company, Ninja::eventVars()));
|
event(new UserWasCreated($user, $user, $this->company, Ninja::eventVars(auth()->user()->id)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $user;
|
return $user;
|
||||||
|
@ -43,8 +43,10 @@ class ArchivedClientActivity implements ShouldQueue
|
|||||||
|
|
||||||
$fields = new stdClass;
|
$fields = new stdClass;
|
||||||
|
|
||||||
|
$user_id = $event->event_vars['user_id'] ?: $event->client->user_id;
|
||||||
|
|
||||||
$fields->client_id = $event->client->id;
|
$fields->client_id = $event->client->id;
|
||||||
$fields->user_id = $event->client->user_id;
|
$fields->user_id = $user_id;
|
||||||
$fields->company_id = $event->client->company_id;
|
$fields->company_id = $event->client->company_id;
|
||||||
$fields->activity_type_id = Activity::ARCHIVE_CLIENT;
|
$fields->activity_type_id = Activity::ARCHIVE_CLIENT;
|
||||||
|
|
||||||
|
@ -45,8 +45,10 @@ class ClientUpdatedActivity implements ShouldQueue
|
|||||||
|
|
||||||
$fields = new stdClass;
|
$fields = new stdClass;
|
||||||
|
|
||||||
|
$user_id = $event->event_vars['user_id'] ?: $event->client->user_id;
|
||||||
|
|
||||||
$fields->client_id = $client->id;
|
$fields->client_id = $client->id;
|
||||||
$fields->user_id = $client->user_id;
|
$fields->user_id = $user_id;
|
||||||
$fields->company_id = $client->company_id;
|
$fields->company_id = $client->company_id;
|
||||||
$fields->activity_type_id = Activity::UPDATE_CLIENT;
|
$fields->activity_type_id = Activity::UPDATE_CLIENT;
|
||||||
|
|
||||||
|
@ -43,8 +43,10 @@ class CreatedClientActivity implements ShouldQueue
|
|||||||
|
|
||||||
$fields = new stdClass;
|
$fields = new stdClass;
|
||||||
|
|
||||||
|
$user_id = $event->event_vars['user_id'] ?: $event->client->user_id;
|
||||||
|
|
||||||
$fields->client_id = $event->client->id;
|
$fields->client_id = $event->client->id;
|
||||||
$fields->user_id = $event->client->user_id;
|
$fields->user_id = $user_id;
|
||||||
$fields->company_id = $event->client->company_id;
|
$fields->company_id = $event->client->company_id;
|
||||||
$fields->activity_type_id = Activity::CREATE_CLIENT;
|
$fields->activity_type_id = Activity::CREATE_CLIENT;
|
||||||
|
|
||||||
|
@ -43,8 +43,10 @@ class CreatedCreditActivity implements ShouldQueue
|
|||||||
|
|
||||||
$fields = new stdClass;
|
$fields = new stdClass;
|
||||||
|
|
||||||
|
$user_id = $event->event_vars['user_id'] ?: $event->credit->user_id;
|
||||||
|
|
||||||
$fields->credit_id = $event->credit->id;
|
$fields->credit_id = $event->credit->id;
|
||||||
$fields->user_id = $event->credit->user_id;
|
$fields->user_id = $user_id;
|
||||||
$fields->client_id = $event->credit->client_id;
|
$fields->client_id = $event->credit->client_id;
|
||||||
|
|
||||||
$fields->company_id = $event->credit->company_id;
|
$fields->company_id = $event->credit->company_id;
|
||||||
|
@ -43,8 +43,11 @@ class CreatedExpenseActivity implements ShouldQueue
|
|||||||
|
|
||||||
$fields = new stdClass;
|
$fields = new stdClass;
|
||||||
|
|
||||||
|
|
||||||
|
$user_id = $event->event_vars['user_id'] ?: $event->expense->user_id;
|
||||||
|
|
||||||
$fields->expense_id = $event->expense->id;
|
$fields->expense_id = $event->expense->id;
|
||||||
$fields->user_id = $event->expense->user_id;
|
$fields->user_id = $user_id;
|
||||||
$fields->company_id = $event->expense->company_id;
|
$fields->company_id = $event->expense->company_id;
|
||||||
$fields->activity_type_id = Activity::CREATE_EXPENSE;
|
$fields->activity_type_id = Activity::CREATE_EXPENSE;
|
||||||
|
|
||||||
|
@ -43,9 +43,11 @@ class CreatedQuoteActivity implements ShouldQueue
|
|||||||
|
|
||||||
$fields = new stdClass;
|
$fields = new stdClass;
|
||||||
|
|
||||||
|
$user_id = $event->event_vars['user_id'] ?: $event->quote->user_id;
|
||||||
|
|
||||||
$fields->quote_id = $event->quote->id;
|
$fields->quote_id = $event->quote->id;
|
||||||
$fields->client_id = $event->quote->client_id;
|
$fields->client_id = $event->quote->client_id;
|
||||||
$fields->user_id = $event->quote->user_id;
|
$fields->user_id = $user_id;
|
||||||
$fields->company_id = $event->quote->company_id;
|
$fields->company_id = $event->quote->company_id;
|
||||||
$fields->activity_type_id = Activity::CREATE_QUOTE;
|
$fields->activity_type_id = Activity::CREATE_QUOTE;
|
||||||
|
|
||||||
|
55
app/Listeners/Activity/CreatedSubscriptionActivity.php
Normal file
55
app/Listeners/Activity/CreatedSubscriptionActivity.php
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Invoice Ninja (https://invoiceninja.com).
|
||||||
|
*
|
||||||
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @license https://opensource.org/licenses/AAL
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Listeners\Activity;
|
||||||
|
|
||||||
|
use App\Libraries\MultiDB;
|
||||||
|
use App\Models\Activity;
|
||||||
|
use App\Repositories\ActivityRepository;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use stdClass;
|
||||||
|
|
||||||
|
class CreatedSubscriptionActivity implements ShouldQueue
|
||||||
|
{
|
||||||
|
protected $activity_repo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the event listener.
|
||||||
|
*
|
||||||
|
* @param ActivityRepository $activity_repo
|
||||||
|
*/
|
||||||
|
public function __construct(ActivityRepository $activity_repo)
|
||||||
|
{
|
||||||
|
$this->activity_repo = $activity_repo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the event.
|
||||||
|
*
|
||||||
|
* @param object $event
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function handle($event)
|
||||||
|
{
|
||||||
|
MultiDB::setDb($event->company->db);
|
||||||
|
|
||||||
|
$fields = new stdClass;
|
||||||
|
|
||||||
|
$user_id = $event->event_vars['user_id'] ?: $event->subscription->user_id;
|
||||||
|
|
||||||
|
$fields->subscription_id = $event->subscription->id;
|
||||||
|
$fields->user_id = $user_id;
|
||||||
|
$fields->company_id = $event->subscription->company_id;
|
||||||
|
$fields->activity_type_id = Activity::CREATE_SUBSCRIPTION;
|
||||||
|
|
||||||
|
$this->activity_repo->save($fields, $event->subscription, $event->event_vars);
|
||||||
|
}
|
||||||
|
}
|
@ -43,8 +43,10 @@ class CreatedTaskActivity implements ShouldQueue
|
|||||||
|
|
||||||
$fields = new stdClass;
|
$fields = new stdClass;
|
||||||
|
|
||||||
|
$user_id = $event->event_vars['user_id'] ?: $event->task->user_id;
|
||||||
|
|
||||||
$fields->task_id = $event->task->id;
|
$fields->task_id = $event->task->id;
|
||||||
$fields->user_id = $event->task->user_id;
|
$fields->user_id = $user_id;
|
||||||
$fields->company_id = $event->task->company_id;
|
$fields->company_id = $event->task->company_id;
|
||||||
$fields->activity_type_id = Activity::CREATE_TASK;
|
$fields->activity_type_id = Activity::CREATE_TASK;
|
||||||
|
|
||||||
|
@ -43,8 +43,10 @@ class CreatedVendorActivity implements ShouldQueue
|
|||||||
|
|
||||||
$fields = new stdClass;
|
$fields = new stdClass;
|
||||||
|
|
||||||
|
$user_id = $event->event_vars['user_id'] ?: $event->vendor->user_id;
|
||||||
|
|
||||||
$fields->vendor_id = $event->vendor->id;
|
$fields->vendor_id = $event->vendor->id;
|
||||||
$fields->user_id = $event->vendor->user_id;
|
$fields->user_id = $user_id;
|
||||||
$fields->company_id = $event->vendor->company_id;
|
$fields->company_id = $event->vendor->company_id;
|
||||||
$fields->activity_type_id = Activity::CREATE_VENDOR;
|
$fields->activity_type_id = Activity::CREATE_VENDOR;
|
||||||
|
|
||||||
|
@ -43,9 +43,11 @@ class CreditArchivedActivity implements ShouldQueue
|
|||||||
|
|
||||||
$fields = new stdClass;
|
$fields = new stdClass;
|
||||||
|
|
||||||
|
$user_id = $event->event_vars['user_id'] ?: $event->credit->user_id;
|
||||||
|
|
||||||
$fields->payment_id = $event->credit->id;
|
$fields->payment_id = $event->credit->id;
|
||||||
$fields->client_id = $event->credit->client_id;
|
$fields->client_id = $event->credit->client_id;
|
||||||
$fields->user_id = $event->credit->user_id;
|
$fields->user_id = $user_id;
|
||||||
$fields->company_id = $event->credit->company_id;
|
$fields->company_id = $event->credit->company_id;
|
||||||
$fields->activity_type_id = Activity::ARCHIVE_CREDIT;
|
$fields->activity_type_id = Activity::ARCHIVE_CREDIT;
|
||||||
|
|
||||||
|
@ -43,8 +43,10 @@ class DeleteClientActivity implements ShouldQueue
|
|||||||
|
|
||||||
$fields = new stdClass;
|
$fields = new stdClass;
|
||||||
|
|
||||||
|
$user_id = $event->event_vars['user_id'] ?: $event->client->user_id;
|
||||||
|
|
||||||
$fields->client_id = $event->client->id;
|
$fields->client_id = $event->client->id;
|
||||||
$fields->user_id = $event->client->user_id;
|
$fields->user_id = $user_id;
|
||||||
$fields->company_id = $event->client->company_id;
|
$fields->company_id = $event->client->company_id;
|
||||||
$fields->activity_type_id = Activity::DELETE_CLIENT;
|
$fields->activity_type_id = Activity::DELETE_CLIENT;
|
||||||
|
|
||||||
|
@ -43,9 +43,11 @@ class DeleteCreditActivity implements ShouldQueue
|
|||||||
|
|
||||||
$fields = new stdClass;
|
$fields = new stdClass;
|
||||||
|
|
||||||
|
$user_id = $event->event_vars['user_id'] ?: $event->credit->user_id;
|
||||||
|
|
||||||
$fields->client_id = $event->credit->client_id;
|
$fields->client_id = $event->credit->client_id;
|
||||||
$fields->credit_id = $event->credit->id;
|
$fields->credit_id = $event->credit->id;
|
||||||
$fields->user_id = $event->credit->user_id;
|
$fields->user_id = $user_id;
|
||||||
$fields->company_id = $event->credit->company_id;
|
$fields->company_id = $event->credit->company_id;
|
||||||
$fields->activity_type_id = Activity::DELETE_CREDIT;
|
$fields->activity_type_id = Activity::DELETE_CREDIT;
|
||||||
|
|
||||||
|
@ -45,8 +45,10 @@ class ExpenseArchivedActivity implements ShouldQueue
|
|||||||
|
|
||||||
$fields = new stdClass;
|
$fields = new stdClass;
|
||||||
|
|
||||||
|
$user_id = $event->event_vars['user_id'] ?: $event->expense->user_id;
|
||||||
|
|
||||||
$fields->expense_id = $expense->id;
|
$fields->expense_id = $expense->id;
|
||||||
$fields->user_id = $expense->user_id;
|
$fields->user_id = $user_id;
|
||||||
$fields->company_id = $expense->company_id;
|
$fields->company_id = $expense->company_id;
|
||||||
$fields->activity_type_id = Activity::ARCHIVE_EXPENSE;
|
$fields->activity_type_id = Activity::ARCHIVE_EXPENSE;
|
||||||
|
|
||||||
|
@ -43,8 +43,10 @@ class ExpenseDeletedActivity implements ShouldQueue
|
|||||||
|
|
||||||
$fields = new stdClass;
|
$fields = new stdClass;
|
||||||
|
|
||||||
|
$user_id = $event->event_vars['user_id'] ?: $event->expense->user_id;
|
||||||
|
|
||||||
$fields->expense_id = $event->expense->id;
|
$fields->expense_id = $event->expense->id;
|
||||||
$fields->user_id = $event->expense->user_id;
|
$fields->user_id = $user_id;
|
||||||
$fields->company_id = $event->expense->company_id;
|
$fields->company_id = $event->expense->company_id;
|
||||||
$fields->activity_type_id = Activity::DELETE_VENDOR;
|
$fields->activity_type_id = Activity::DELETE_VENDOR;
|
||||||
|
|
||||||
|
@ -43,8 +43,10 @@ class ExpenseRestoredActivity implements ShouldQueue
|
|||||||
|
|
||||||
$fields = new stdClass;
|
$fields = new stdClass;
|
||||||
|
|
||||||
|
$user_id = $event->event_vars['user_id'] ?: $event->expense->user_id;
|
||||||
|
|
||||||
$fields->expense_id = $event->expense->id;
|
$fields->expense_id = $event->expense->id;
|
||||||
$fields->user_id = $event->expense->user_id;
|
$fields->user_id = $user_id;
|
||||||
$fields->company_id = $event->expense->company_id;
|
$fields->company_id = $event->expense->company_id;
|
||||||
$fields->activity_type_id = Activity::RESTORE_EXPENSE;
|
$fields->activity_type_id = Activity::RESTORE_EXPENSE;
|
||||||
|
|
||||||
|
@ -43,10 +43,12 @@ class ExpenseUpdatedActivity implements ShouldQueue
|
|||||||
|
|
||||||
$expense = $event->expense;
|
$expense = $event->expense;
|
||||||
|
|
||||||
|
$user_id = $event->event_vars['user_id'] ?: $event->expense->user_id;
|
||||||
|
|
||||||
$fields = new stdClass;
|
$fields = new stdClass;
|
||||||
|
|
||||||
$fields->expense_id = $expense->id;
|
$fields->expense_id = $expense->id;
|
||||||
$fields->user_id = $expense->user_id;
|
$fields->user_id = $user_id;
|
||||||
$fields->company_id = $expense->company_id;
|
$fields->company_id = $expense->company_id;
|
||||||
$fields->activity_type_id = Activity::UPDATE_EXPENSE;
|
$fields->activity_type_id = Activity::UPDATE_EXPENSE;
|
||||||
|
|
||||||
|
@ -48,9 +48,11 @@ class PaymentArchivedActivity implements ShouldQueue
|
|||||||
|
|
||||||
$fields = new stdClass;
|
$fields = new stdClass;
|
||||||
|
|
||||||
|
$user_id = $event->event_vars['user_id'] ?: $event->payment->user_id;
|
||||||
|
|
||||||
$fields->payment_id = $payment->id;
|
$fields->payment_id = $payment->id;
|
||||||
$fields->client_id = $payment->client_id;
|
$fields->client_id = $payment->client_id;
|
||||||
$fields->user_id = $payment->user_id;
|
$fields->user_id = $user_id;
|
||||||
$fields->company_id = $payment->company_id;
|
$fields->company_id = $payment->company_id;
|
||||||
$fields->activity_type_id = Activity::ARCHIVE_PAYMENT;
|
$fields->activity_type_id = Activity::ARCHIVE_PAYMENT;
|
||||||
|
|
||||||
|
@ -43,13 +43,15 @@ class PaymentCreatedActivity implements ShouldQueue
|
|||||||
|
|
||||||
$payment = $event->payment;
|
$payment = $event->payment;
|
||||||
|
|
||||||
|
$user_id = $event->event_vars['user_id'] ?: $event->payment->user_id;
|
||||||
|
|
||||||
$invoices = $payment->invoices;
|
$invoices = $payment->invoices;
|
||||||
|
|
||||||
$fields = new stdClass;
|
$fields = new stdClass;
|
||||||
|
|
||||||
$fields->payment_id = $payment->id;
|
$fields->payment_id = $payment->id;
|
||||||
$fields->client_id = $payment->client_id;
|
$fields->client_id = $payment->client_id;
|
||||||
$fields->user_id = $payment->user_id;
|
$fields->user_id = $user_id;
|
||||||
$fields->company_id = $payment->company_id;
|
$fields->company_id = $payment->company_id;
|
||||||
$fields->activity_type_id = Activity::CREATE_PAYMENT;
|
$fields->activity_type_id = Activity::CREATE_PAYMENT;
|
||||||
|
|
||||||
|
@ -43,13 +43,15 @@ class PaymentDeletedActivity implements ShouldQueue
|
|||||||
|
|
||||||
$payment = $event->payment;
|
$payment = $event->payment;
|
||||||
|
|
||||||
|
$user_id = $event->event_vars['user_id'] ?: $event->payment->user_id;
|
||||||
|
|
||||||
$invoices = $payment->invoices;
|
$invoices = $payment->invoices;
|
||||||
|
|
||||||
$fields = new stdClass;
|
$fields = new stdClass;
|
||||||
|
|
||||||
$fields->payment_id = $payment->id;
|
$fields->payment_id = $payment->id;
|
||||||
$fields->client_id = $payment->client_id;
|
$fields->client_id = $payment->client_id;
|
||||||
$fields->user_id = $payment->user_id;
|
$fields->user_id = $user_id;
|
||||||
$fields->company_id = $payment->company_id;
|
$fields->company_id = $payment->company_id;
|
||||||
$fields->activity_type_id = Activity::DELETE_PAYMENT;
|
$fields->activity_type_id = Activity::DELETE_PAYMENT;
|
||||||
|
|
||||||
|
@ -43,9 +43,11 @@ class PaymentRefundedActivity implements ShouldQueue
|
|||||||
|
|
||||||
$fields = new stdClass;
|
$fields = new stdClass;
|
||||||
|
|
||||||
|
$user_id = $event->event_vars['user_id'] ?: $event->payment->user_id;
|
||||||
|
|
||||||
$fields->client_id = $event->payment->id;
|
$fields->client_id = $event->payment->id;
|
||||||
$fields->client_id = $event->payment->client_id;
|
$fields->client_id = $event->payment->client_id;
|
||||||
$fields->user_id = $event->payment->user_id;
|
$fields->user_id = $user_id;
|
||||||
$fields->company_id = $event->payment->company_id;
|
$fields->company_id = $event->payment->company_id;
|
||||||
$fields->activity_type_id = Activity::REFUNDED_PAYMENT;
|
$fields->activity_type_id = Activity::REFUNDED_PAYMENT;
|
||||||
$fields->payment_id = $event->payment->id;
|
$fields->payment_id = $event->payment->id;
|
||||||
|
@ -48,9 +48,11 @@ class PaymentUpdatedActivity implements ShouldQueue
|
|||||||
|
|
||||||
$fields = new stdClass;
|
$fields = new stdClass;
|
||||||
|
|
||||||
|
$user_id = $event->event_vars['user_id'] ?: $event->payment->user_id;
|
||||||
|
|
||||||
$fields->payment_id = $payment->id;
|
$fields->payment_id = $payment->id;
|
||||||
$fields->client_id = $payment->client_id;
|
$fields->client_id = $payment->client_id;
|
||||||
$fields->user_id = $payment->user_id;
|
$fields->user_id = $user_id;
|
||||||
$fields->company_id = $payment->company_id;
|
$fields->company_id = $payment->company_id;
|
||||||
$fields->activity_type_id = Activity::UPDATE_PAYMENT;
|
$fields->activity_type_id = Activity::UPDATE_PAYMENT;
|
||||||
|
|
||||||
|
@ -43,8 +43,10 @@ class PaymentVoidedActivity implements ShouldQueue
|
|||||||
|
|
||||||
$fields = new stdClass;
|
$fields = new stdClass;
|
||||||
|
|
||||||
|
$user_id = $event->event_vars['user_id'] ?: $event->payment->user_id;
|
||||||
|
|
||||||
$fields->client_id = $event->payment->id;
|
$fields->client_id = $event->payment->id;
|
||||||
$fields->user_id = $event->payment->user_id;
|
$fields->user_id = $user_id;
|
||||||
$fields->company_id = $event->payment->company_id;
|
$fields->company_id = $event->payment->company_id;
|
||||||
$fields->activity_type_id = Activity::VOIDED_PAYMENT;
|
$fields->activity_type_id = Activity::VOIDED_PAYMENT;
|
||||||
$fields->payment_id = $event->payment->id;
|
$fields->payment_id = $event->payment->id;
|
||||||
|
@ -45,9 +45,11 @@ class QuoteUpdatedActivity implements ShouldQueue
|
|||||||
|
|
||||||
$fields = new stdClass;
|
$fields = new stdClass;
|
||||||
|
|
||||||
|
$user_id = $event->event_vars['user_id'] ?: $event->quote->user_id;
|
||||||
|
|
||||||
$fields->quote_id = $quote->id;
|
$fields->quote_id = $quote->id;
|
||||||
$fields->client_id = $quote->client_id;
|
$fields->client_id = $quote->client_id;
|
||||||
$fields->user_id = $quote->user_id;
|
$fields->user_id = $user_id;
|
||||||
$fields->company_id = $quote->company_id;
|
$fields->company_id = $quote->company_id;
|
||||||
$fields->activity_type_id = Activity::UPDATE_QUOTE;
|
$fields->activity_type_id = Activity::UPDATE_QUOTE;
|
||||||
|
|
||||||
|
@ -43,8 +43,10 @@ class RestoreClientActivity implements ShouldQueue
|
|||||||
|
|
||||||
$fields = new stdClass;
|
$fields = new stdClass;
|
||||||
|
|
||||||
|
$user_id = $event->event_vars['user_id'] ?: $event->client->user_id;
|
||||||
|
|
||||||
$fields->client_id = $event->client->id;
|
$fields->client_id = $event->client->id;
|
||||||
$fields->user_id = $event->client->user_id;
|
$fields->user_id = $user_id;
|
||||||
$fields->company_id = $event->client->company_id;
|
$fields->company_id = $event->client->company_id;
|
||||||
$fields->activity_type_id = Activity::RESTORE_CLIENT;
|
$fields->activity_type_id = Activity::RESTORE_CLIENT;
|
||||||
|
|
||||||
|
57
app/Listeners/Activity/SubscriptionArchivedActivity.php
Normal file
57
app/Listeners/Activity/SubscriptionArchivedActivity.php
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Invoice Ninja (https://invoiceninja.com).
|
||||||
|
*
|
||||||
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @license https://opensource.org/licenses/AAL
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Listeners\Activity;
|
||||||
|
|
||||||
|
use App\Libraries\MultiDB;
|
||||||
|
use App\Models\Activity;
|
||||||
|
use App\Repositories\ActivityRepository;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use stdClass;
|
||||||
|
|
||||||
|
class SubscriptionArchivedActivity implements ShouldQueue
|
||||||
|
{
|
||||||
|
protected $activity_repo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the event listener.
|
||||||
|
*
|
||||||
|
* @param ActivityRepository $activity_repo
|
||||||
|
*/
|
||||||
|
public function __construct(ActivityRepository $activity_repo)
|
||||||
|
{
|
||||||
|
$this->activity_repo = $activity_repo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the event.
|
||||||
|
*
|
||||||
|
* @param object $event
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function handle($event)
|
||||||
|
{
|
||||||
|
MultiDB::setDb($event->company->db);
|
||||||
|
|
||||||
|
$subscription = $event->subscription;
|
||||||
|
|
||||||
|
$fields = new stdClass;
|
||||||
|
|
||||||
|
$user_id = $event->event_vars['user_id'] ?: $event->subscription->user_id;
|
||||||
|
|
||||||
|
$fields->subscription_id = $subscription->id;
|
||||||
|
$fields->user_id = $user_id;
|
||||||
|
$fields->company_id = $subscription->company_id;
|
||||||
|
$fields->activity_type_id = Activity::ARCHIVE_SUBSCRIPTIOn;
|
||||||
|
|
||||||
|
$this->activity_repo->save($fields, $subscription, $event->event_vars);
|
||||||
|
}
|
||||||
|
}
|
55
app/Listeners/Activity/SubscriptionDeletedActivity.php
Normal file
55
app/Listeners/Activity/SubscriptionDeletedActivity.php
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Invoice Ninja (https://invoiceninja.com).
|
||||||
|
*
|
||||||
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @license https://opensource.org/licenses/AAL
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Listeners\Activity;
|
||||||
|
|
||||||
|
use App\Libraries\MultiDB;
|
||||||
|
use App\Models\Activity;
|
||||||
|
use App\Repositories\ActivityRepository;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use stdClass;
|
||||||
|
|
||||||
|
class SubscriptionDeletedActivity implements ShouldQueue
|
||||||
|
{
|
||||||
|
protected $activity_repo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the event listener.
|
||||||
|
*
|
||||||
|
* @param ActivityRepository $activity_repo
|
||||||
|
*/
|
||||||
|
public function __construct(ActivityRepository $activity_repo)
|
||||||
|
{
|
||||||
|
$this->activity_repo = $activity_repo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the event.
|
||||||
|
*
|
||||||
|
* @param object $event
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function handle($event)
|
||||||
|
{
|
||||||
|
MultiDB::setDb($event->company->db);
|
||||||
|
|
||||||
|
$fields = new stdClass;
|
||||||
|
|
||||||
|
$user_id = $event->event_vars['user_id'] ?: $event->subscription->user_id;
|
||||||
|
|
||||||
|
$fields->subscription_id = $event->subscription->id;
|
||||||
|
$fields->user_id = $user_id;
|
||||||
|
$fields->company_id = $event->subscription->company_id;
|
||||||
|
$fields->activity_type_id = Activity::DELETE_SUBSCRIPTION;
|
||||||
|
|
||||||
|
$this->activity_repo->save($fields, $event->subscription, $event->event_vars);
|
||||||
|
}
|
||||||
|
}
|
55
app/Listeners/Activity/SubscriptionRestoredActivity.php
Normal file
55
app/Listeners/Activity/SubscriptionRestoredActivity.php
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Invoice Ninja (https://invoiceninja.com).
|
||||||
|
*
|
||||||
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @license https://opensource.org/licenses/AAL
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Listeners\Activity;
|
||||||
|
|
||||||
|
use App\Libraries\MultiDB;
|
||||||
|
use App\Models\Activity;
|
||||||
|
use App\Repositories\ActivityRepository;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use stdClass;
|
||||||
|
|
||||||
|
class SubscriptionRestoredActivity implements ShouldQueue
|
||||||
|
{
|
||||||
|
protected $activity_repo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the event listener.
|
||||||
|
*
|
||||||
|
* @param ActivityRepository $activity_repo
|
||||||
|
*/
|
||||||
|
public function __construct(ActivityRepository $activity_repo)
|
||||||
|
{
|
||||||
|
$this->activity_repo = $activity_repo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the event.
|
||||||
|
*
|
||||||
|
* @param object $event
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function handle($event)
|
||||||
|
{
|
||||||
|
MultiDB::setDb($event->company->db);
|
||||||
|
|
||||||
|
$fields = new stdClass;
|
||||||
|
|
||||||
|
$user_id = $event->event_vars['user_id'] ?: $event->subscription->user_id;
|
||||||
|
|
||||||
|
$fields->subscription_id = $event->subscription->id;
|
||||||
|
$fields->user_id = $user_id;
|
||||||
|
$fields->company_id = $event->subscription->company_id;
|
||||||
|
$fields->activity_type_id = Activity::RESTORE_SUBSCRIPTION;
|
||||||
|
|
||||||
|
$this->activity_repo->save($fields, $event->subscription, $event->event_vars);
|
||||||
|
}
|
||||||
|
}
|
57
app/Listeners/Activity/SubscriptionUpdatedActivity.php
Normal file
57
app/Listeners/Activity/SubscriptionUpdatedActivity.php
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Invoice Ninja (https://invoiceninja.com).
|
||||||
|
*
|
||||||
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @license https://opensource.org/licenses/AAL
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Listeners\Activity;
|
||||||
|
|
||||||
|
use App\Libraries\MultiDB;
|
||||||
|
use App\Models\Activity;
|
||||||
|
use App\Repositories\ActivityRepository;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use stdClass;
|
||||||
|
|
||||||
|
class SubscriptionUpdatedActivity implements ShouldQueue
|
||||||
|
{
|
||||||
|
protected $activity_repo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the event listener.
|
||||||
|
*
|
||||||
|
* @param ActivityRepository $activity_repo
|
||||||
|
*/
|
||||||
|
public function __construct(ActivityRepository $activity_repo)
|
||||||
|
{
|
||||||
|
$this->activity_repo = $activity_repo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the event.
|
||||||
|
*
|
||||||
|
* @param object $event
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function handle($event)
|
||||||
|
{
|
||||||
|
MultiDB::setDb($event->company->db);
|
||||||
|
|
||||||
|
$subscription = $event->subscription;
|
||||||
|
|
||||||
|
$fields = new stdClass;
|
||||||
|
|
||||||
|
$user_id = $event->event_vars['user_id'] ?: $event->subscription->user_id;
|
||||||
|
|
||||||
|
$fields->subscription_id = $subscription->id;
|
||||||
|
$fields->user_id = $user_id;
|
||||||
|
$fields->company_id = $subscription->company_id;
|
||||||
|
$fields->activity_type_id = Activity::UPDATE_SUBSCRIPTION;
|
||||||
|
|
||||||
|
$this->activity_repo->save($fields, $subscription, $event->event_vars);
|
||||||
|
}
|
||||||
|
}
|
@ -45,8 +45,10 @@ class TaskArchivedActivity implements ShouldQueue
|
|||||||
|
|
||||||
$fields = new stdClass;
|
$fields = new stdClass;
|
||||||
|
|
||||||
|
$user_id = $event->event_vars['user_id'] ?: $event->task->user_id;
|
||||||
|
|
||||||
$fields->task_id = $task->id;
|
$fields->task_id = $task->id;
|
||||||
$fields->user_id = $task->user_id;
|
$fields->user_id = $user_id;
|
||||||
$fields->company_id = $task->company_id;
|
$fields->company_id = $task->company_id;
|
||||||
$fields->activity_type_id = Activity::ARCHIVE_TASK;
|
$fields->activity_type_id = Activity::ARCHIVE_TASK;
|
||||||
|
|
||||||
|
@ -43,8 +43,10 @@ class TaskDeletedActivity implements ShouldQueue
|
|||||||
|
|
||||||
$fields = new stdClass;
|
$fields = new stdClass;
|
||||||
|
|
||||||
|
$user_id = $event->event_vars['user_id'] ?: $event->task->user_id;
|
||||||
|
|
||||||
$fields->task_id = $event->task->id;
|
$fields->task_id = $event->task->id;
|
||||||
$fields->user_id = $event->task->user_id;
|
$fields->user_id = $user_id;
|
||||||
$fields->company_id = $event->task->company_id;
|
$fields->company_id = $event->task->company_id;
|
||||||
$fields->activity_type_id = Activity::DELETE_TASK;
|
$fields->activity_type_id = Activity::DELETE_TASK;
|
||||||
|
|
||||||
|
@ -43,8 +43,10 @@ class TaskRestoredActivity implements ShouldQueue
|
|||||||
|
|
||||||
$fields = new stdClass;
|
$fields = new stdClass;
|
||||||
|
|
||||||
|
$user_id = $event->event_vars['user_id'] ?: $event->task->user_id;
|
||||||
|
|
||||||
$fields->task_id = $event->task->id;
|
$fields->task_id = $event->task->id;
|
||||||
$fields->user_id = $event->task->user_id;
|
$fields->user_id = $user_id;
|
||||||
$fields->company_id = $event->task->company_id;
|
$fields->company_id = $event->task->company_id;
|
||||||
$fields->activity_type_id = Activity::RESTORE_TASK;
|
$fields->activity_type_id = Activity::RESTORE_TASK;
|
||||||
|
|
||||||
|
@ -45,8 +45,10 @@ class TaskUpdatedActivity implements ShouldQueue
|
|||||||
|
|
||||||
$fields = new stdClass;
|
$fields = new stdClass;
|
||||||
|
|
||||||
|
$user_id = $event->event_vars['user_id'] ?: $event->task->user_id;
|
||||||
|
|
||||||
$fields->task_id = $task->id;
|
$fields->task_id = $task->id;
|
||||||
$fields->user_id = $task->user_id;
|
$fields->user_id = $user_id;
|
||||||
$fields->company_id = $task->company_id;
|
$fields->company_id = $task->company_id;
|
||||||
$fields->activity_type_id = Activity::UPDATE_TASK;
|
$fields->activity_type_id = Activity::UPDATE_TASK;
|
||||||
|
|
||||||
|
@ -43,9 +43,11 @@ class UpdatedCreditActivity implements ShouldQueue
|
|||||||
|
|
||||||
$fields = new stdClass;
|
$fields = new stdClass;
|
||||||
|
|
||||||
|
$user_id = $event->event_vars['user_id'] ?: $event->credit->user_id;
|
||||||
|
|
||||||
$fields->credit_id = $event->credit->id;
|
$fields->credit_id = $event->credit->id;
|
||||||
$fields->client_id = $event->credit->client_id;
|
$fields->client_id = $event->credit->client_id;
|
||||||
$fields->user_id = $event->credit->user_id;
|
$fields->user_id = $user_id;
|
||||||
$fields->company_id = $event->credit->company_id;
|
$fields->company_id = $event->credit->company_id;
|
||||||
$fields->activity_type_id = Activity::UPDATE_CREDIT;
|
$fields->activity_type_id = Activity::UPDATE_CREDIT;
|
||||||
|
|
||||||
|
@ -45,8 +45,10 @@ class VendorArchivedActivity implements ShouldQueue
|
|||||||
|
|
||||||
$fields = new stdClass;
|
$fields = new stdClass;
|
||||||
|
|
||||||
|
$user_id = $event->event_vars['user_id'] ?: $event->vendor->user_id;
|
||||||
|
|
||||||
$fields->vendor_id = $vendor->id;
|
$fields->vendor_id = $vendor->id;
|
||||||
$fields->user_id = $vendor->user_id;
|
$fields->user_id = $user_id;
|
||||||
$fields->company_id = $vendor->company_id;
|
$fields->company_id = $vendor->company_id;
|
||||||
$fields->activity_type_id = Activity::ARCHIVE_VENDOR;
|
$fields->activity_type_id = Activity::ARCHIVE_VENDOR;
|
||||||
|
|
||||||
|
@ -43,8 +43,10 @@ class VendorDeletedActivity implements ShouldQueue
|
|||||||
|
|
||||||
$fields = new stdClass;
|
$fields = new stdClass;
|
||||||
|
|
||||||
|
$user_id = $event->event_vars['user_id'] ?: $event->vendor->user_id;
|
||||||
|
|
||||||
$fields->vendor_id = $event->vendor->id;
|
$fields->vendor_id = $event->vendor->id;
|
||||||
$fields->user_id = $event->vendor->user_id;
|
$fields->user_id = $user_id;
|
||||||
$fields->company_id = $event->vendor->company_id;
|
$fields->company_id = $event->vendor->company_id;
|
||||||
$fields->activity_type_id = Activity::DELETE_VENDOR;
|
$fields->activity_type_id = Activity::DELETE_VENDOR;
|
||||||
|
|
||||||
|
@ -43,8 +43,10 @@ class VendorRestoredActivity implements ShouldQueue
|
|||||||
|
|
||||||
$fields = new stdClass;
|
$fields = new stdClass;
|
||||||
|
|
||||||
|
$user_id = $event->event_vars['user_id'] ?: $event->vendor->user_id;
|
||||||
|
|
||||||
$fields->vendor_id = $event->vendor->id;
|
$fields->vendor_id = $event->vendor->id;
|
||||||
$fields->user_id = $event->vendor->user_id;
|
$fields->user_id = $user_id;
|
||||||
$fields->company_id = $event->vendor->company_id;
|
$fields->company_id = $event->vendor->company_id;
|
||||||
$fields->activity_type_id = Activity::RESTORE_VENDOR;
|
$fields->activity_type_id = Activity::RESTORE_VENDOR;
|
||||||
|
|
||||||
|
@ -45,8 +45,10 @@ class VendorUpdatedActivity implements ShouldQueue
|
|||||||
|
|
||||||
$fields = new stdClass;
|
$fields = new stdClass;
|
||||||
|
|
||||||
|
$user_id = $event->event_vars['user_id'] ?: $event->vendor->user_id;
|
||||||
|
|
||||||
$fields->vendor_id = $vendor->id;
|
$fields->vendor_id = $vendor->id;
|
||||||
$fields->user_id = $vendor->user_id;
|
$fields->user_id = $user_id;
|
||||||
$fields->company_id = $vendor->company_id;
|
$fields->company_id = $vendor->company_id;
|
||||||
$fields->activity_type_id = Activity::UPDATE_VENDOR;
|
$fields->activity_type_id = Activity::UPDATE_VENDOR;
|
||||||
|
|
||||||
|
@ -84,6 +84,12 @@ class Activity extends StaticModel
|
|||||||
const INVOICE_REMINDER3_SENT = 65;
|
const INVOICE_REMINDER3_SENT = 65;
|
||||||
const INVOICE_REMINDER_ENDLESS_SENT = 66;
|
const INVOICE_REMINDER_ENDLESS_SENT = 66;
|
||||||
|
|
||||||
|
const CREATE_SUBSCRIPTION = 80;
|
||||||
|
const UPDATE_SUBSCRIPTION = 81;
|
||||||
|
const ARCHIVE_SUBSCRIPTION = 82;
|
||||||
|
const DELETE_SUBSCRIPTION = 83;
|
||||||
|
const RESTORE_SUBSCRIPTION = 84;
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'is_system' => 'boolean',
|
'is_system' => 'boolean',
|
||||||
'updated_at' => 'timestamp',
|
'updated_at' => 'timestamp',
|
||||||
|
@ -255,10 +255,10 @@ class Credit extends BaseModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (! $invitation) {
|
if (! $invitation) {
|
||||||
event(new CreditWasUpdated($this, $this->company, Ninja::eventVars()));
|
event(new CreditWasUpdated($this, $this->company, Ninja::eventVars(auth()->user()->id)));
|
||||||
CreateEntityPdf::dispatchNow($this->invitations->first());
|
CreateEntityPdf::dispatchNow($this->invitations->first());
|
||||||
} else {
|
} else {
|
||||||
event(new CreditWasUpdated($this, $this->company, Ninja::eventVars()));
|
event(new CreditWasUpdated($this, $this->company, Ninja::eventVars(auth()->user()->id)));
|
||||||
CreateEntityPdf::dispatchNow($invitation);
|
CreateEntityPdf::dispatchNow($invitation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ class CreditInvitation extends BaseModel
|
|||||||
$storage_path = Storage::url($this->credit->client->quote_filepath().$this->credit->numberFormatter().'.pdf');
|
$storage_path = Storage::url($this->credit->client->quote_filepath().$this->credit->numberFormatter().'.pdf');
|
||||||
|
|
||||||
if (! Storage::exists($this->credit->client->credit_filepath().$this->credit->numberFormatter().'.pdf')) {
|
if (! Storage::exists($this->credit->client->credit_filepath().$this->credit->numberFormatter().'.pdf')) {
|
||||||
event(new CreditWasUpdated($this, $this->company, Ninja::eventVars()));
|
event(new CreditWasUpdated($this, $this->company, Ninja::eventVars(auth()->user()->id)));
|
||||||
CreateEntityPdf::dispatchNow($this);
|
CreateEntityPdf::dispatchNow($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -397,7 +397,7 @@ class Invoice extends BaseModel
|
|||||||
$storage_path = Storage::$type($this->client->invoice_filepath().$this->numberFormatter().'.pdf');
|
$storage_path = Storage::$type($this->client->invoice_filepath().$this->numberFormatter().'.pdf');
|
||||||
|
|
||||||
if (! Storage::exists($this->client->invoice_filepath().$this->numberFormatter().'.pdf')) {
|
if (! Storage::exists($this->client->invoice_filepath().$this->numberFormatter().'.pdf')) {
|
||||||
event(new InvoiceWasUpdated($this, $this->company, Ninja::eventVars()));
|
event(new InvoiceWasUpdated($this, $this->company, Ninja::eventVars(auth()->user()->id)));
|
||||||
CreateEntityPdf::dispatchNow($invitation);
|
CreateEntityPdf::dispatchNow($invitation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ class InvoiceInvitation extends BaseModel
|
|||||||
$storage_path = Storage::url($this->invoice->client->invoice_filepath().$this->invoice->numberFormatter().'.pdf');
|
$storage_path = Storage::url($this->invoice->client->invoice_filepath().$this->invoice->numberFormatter().'.pdf');
|
||||||
|
|
||||||
if (! Storage::exists($this->invoice->client->invoice_filepath().$this->invoice->numberFormatter().'.pdf')) {
|
if (! Storage::exists($this->invoice->client->invoice_filepath().$this->invoice->numberFormatter().'.pdf')) {
|
||||||
event(new InvoiceWasUpdated($this->invoice, $this->company, Ninja::eventVars()));
|
event(new InvoiceWasUpdated($this->invoice, $this->company, Ninja::eventVars(auth()->user()->id)));
|
||||||
CreateEntityPdf::dispatchNow($this);
|
CreateEntityPdf::dispatchNow($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,7 +243,7 @@ class Payment extends BaseModel
|
|||||||
$this->status_id = $this->refunded == $this->amount ? self::STATUS_REFUNDED : self::STATUS_PARTIALLY_REFUNDED;
|
$this->status_id = $this->refunded == $this->amount ? self::STATUS_REFUNDED : self::STATUS_PARTIALLY_REFUNDED;
|
||||||
$this->save();
|
$this->save();
|
||||||
|
|
||||||
event(new PaymentWasRefunded($this, $refund_change, $this->company, Ninja::eventVars()));
|
event(new PaymentWasRefunded($this, $refund_change, $this->company, Ninja::eventVars(auth()->user()->id)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -280,7 +280,7 @@ class Payment extends BaseModel
|
|||||||
$this->status_id = self::STATUS_CANCELLED;
|
$this->status_id = self::STATUS_CANCELLED;
|
||||||
$this->save();
|
$this->save();
|
||||||
|
|
||||||
event(new PaymentWasVoided($this, $this->company, Ninja::eventVars()));
|
event(new PaymentWasVoided($this, $this->company, Ninja::eventVars(auth()->user()->id)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLink()
|
public function getLink()
|
||||||
|
@ -213,7 +213,7 @@ class Quote extends BaseModel
|
|||||||
nlog($storage_path);
|
nlog($storage_path);
|
||||||
|
|
||||||
if (! Storage::exists($this->client->quote_filepath().$this->numberFormatter().'.pdf')) {
|
if (! Storage::exists($this->client->quote_filepath().$this->numberFormatter().'.pdf')) {
|
||||||
event(new QuoteWasUpdated($this, $this->company, Ninja::eventVars()));
|
event(new QuoteWasUpdated($this, $this->company, Ninja::eventVars(auth()->user()->id)));
|
||||||
CreateEntityPdf::dispatchNow($invitation);
|
CreateEntityPdf::dispatchNow($invitation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ class QuoteInvitation extends BaseModel
|
|||||||
$storage_path = Storage::url($this->quote->client->quote_filepath().$this->quote->numberFormatter().'.pdf');
|
$storage_path = Storage::url($this->quote->client->quote_filepath().$this->quote->numberFormatter().'.pdf');
|
||||||
|
|
||||||
if (! Storage::exists($this->quote->client->quote_filepath().$this->quote->numberFormatter().'.pdf')) {
|
if (! Storage::exists($this->quote->client->quote_filepath().$this->quote->numberFormatter().'.pdf')) {
|
||||||
event(new QuoteWasUpdated($this->quote, $this->company, Ninja::eventVars()));
|
event(new QuoteWasUpdated($this->quote, $this->company, Ninja::eventVars(auth()->user()->id)));
|
||||||
CreateEntityPdf::dispatchNow($this);
|
CreateEntityPdf::dispatchNow($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,12 @@
|
|||||||
|
|
||||||
namespace App\PaymentDrivers;
|
namespace App\PaymentDrivers;
|
||||||
|
|
||||||
|
use App\Models\ClientGatewayToken;
|
||||||
|
use App\Models\GatewayType;
|
||||||
|
use App\Models\Payment;
|
||||||
|
use App\Models\PaymentHash;
|
||||||
|
use App\Models\SystemLog;
|
||||||
|
use App\PaymentDrivers\Stripe\CreditCard;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
|
|
||||||
class DriverTemplate extends BaseDriver
|
class DriverTemplate extends BaseDriver
|
||||||
|
@ -67,6 +67,11 @@ use App\Events\Quote\QuoteWasEmailed;
|
|||||||
use App\Events\Quote\QuoteWasRestored;
|
use App\Events\Quote\QuoteWasRestored;
|
||||||
use App\Events\Quote\QuoteWasUpdated;
|
use App\Events\Quote\QuoteWasUpdated;
|
||||||
use App\Events\Quote\QuoteWasViewed;
|
use App\Events\Quote\QuoteWasViewed;
|
||||||
|
use App\Events\Subscription\SubscriptionWasArchived;
|
||||||
|
use App\Events\Subscription\SubscriptionWasCreated;
|
||||||
|
use App\Events\Subscription\SubscriptionWasDeleted;
|
||||||
|
use App\Events\Subscription\SubscriptionWasRestored;
|
||||||
|
use App\Events\Subscription\SubscriptionWasUpdated;
|
||||||
use App\Events\Task\TaskWasArchived;
|
use App\Events\Task\TaskWasArchived;
|
||||||
use App\Events\Task\TaskWasCreated;
|
use App\Events\Task\TaskWasCreated;
|
||||||
use App\Events\Task\TaskWasDeleted;
|
use App\Events\Task\TaskWasDeleted;
|
||||||
@ -89,6 +94,7 @@ use App\Listeners\Activity\CreatedClientActivity;
|
|||||||
use App\Listeners\Activity\CreatedCreditActivity;
|
use App\Listeners\Activity\CreatedCreditActivity;
|
||||||
use App\Listeners\Activity\CreatedExpenseActivity;
|
use App\Listeners\Activity\CreatedExpenseActivity;
|
||||||
use App\Listeners\Activity\CreatedQuoteActivity;
|
use App\Listeners\Activity\CreatedQuoteActivity;
|
||||||
|
use App\Listeners\Activity\CreatedSubscriptionActivity;
|
||||||
use App\Listeners\Activity\CreatedTaskActivity;
|
use App\Listeners\Activity\CreatedTaskActivity;
|
||||||
use App\Listeners\Activity\CreatedVendorActivity;
|
use App\Listeners\Activity\CreatedVendorActivity;
|
||||||
use App\Listeners\Activity\CreditArchivedActivity;
|
use App\Listeners\Activity\CreditArchivedActivity;
|
||||||
@ -106,6 +112,10 @@ use App\Listeners\Activity\PaymentUpdatedActivity;
|
|||||||
use App\Listeners\Activity\PaymentVoidedActivity;
|
use App\Listeners\Activity\PaymentVoidedActivity;
|
||||||
use App\Listeners\Activity\QuoteUpdatedActivity;
|
use App\Listeners\Activity\QuoteUpdatedActivity;
|
||||||
use App\Listeners\Activity\RestoreClientActivity;
|
use App\Listeners\Activity\RestoreClientActivity;
|
||||||
|
use App\Listeners\Activity\SubscriptionArchivedActivity;
|
||||||
|
use App\Listeners\Activity\SubscriptionDeletedActivity;
|
||||||
|
use App\Listeners\Activity\SubscriptionRestoredActivity;
|
||||||
|
use App\Listeners\Activity\SubscriptionUpdatedActivity;
|
||||||
use App\Listeners\Activity\TaskArchivedActivity;
|
use App\Listeners\Activity\TaskArchivedActivity;
|
||||||
use App\Listeners\Activity\TaskDeletedActivity;
|
use App\Listeners\Activity\TaskDeletedActivity;
|
||||||
use App\Listeners\Activity\TaskRestoredActivity;
|
use App\Listeners\Activity\TaskRestoredActivity;
|
||||||
@ -396,6 +406,21 @@ class EventServiceProvider extends ServiceProvider
|
|||||||
TaskWasRestored::class => [
|
TaskWasRestored::class => [
|
||||||
TaskRestoredActivity::class,
|
TaskRestoredActivity::class,
|
||||||
],
|
],
|
||||||
|
SubscriptionWasCreated::class => [
|
||||||
|
CreatedSubscriptionActivity::class,
|
||||||
|
],
|
||||||
|
SubscriptionWasUpdated::class => [
|
||||||
|
SubscriptionUpdatedActivity::class,
|
||||||
|
],
|
||||||
|
SubscriptionWasArchived::class => [
|
||||||
|
SubscriptionArchivedActivity::class,
|
||||||
|
],
|
||||||
|
SubscriptionWasDeleted::class => [
|
||||||
|
SubscriptionDeletedActivity::class,
|
||||||
|
],
|
||||||
|
SubscriptionWasRestored::class => [
|
||||||
|
SubscriptionRestoredActivity::class,
|
||||||
|
],
|
||||||
VendorWasCreated::class => [
|
VendorWasCreated::class => [
|
||||||
CreatedVendorActivity::class,
|
CreatedVendorActivity::class,
|
||||||
],
|
],
|
||||||
|
@ -55,7 +55,7 @@ class BaseRepository
|
|||||||
$className = $this->getEventClass($entity, 'Archived');
|
$className = $this->getEventClass($entity, 'Archived');
|
||||||
|
|
||||||
if (class_exists($className)) {
|
if (class_exists($className)) {
|
||||||
event(new $className($entity, $entity->company, Ninja::eventVars()));
|
event(new $className($entity, $entity->company, Ninja::eventVars(auth()->user()->id)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ class BaseRepository
|
|||||||
$className = $this->getEventClass($entity, 'Restored');
|
$className = $this->getEventClass($entity, 'Restored');
|
||||||
|
|
||||||
if (class_exists($className)) {
|
if (class_exists($className)) {
|
||||||
event(new $className($entity, $fromDeleted, $entity->company, Ninja::eventVars()));
|
event(new $className($entity, $fromDeleted, $entity->company, Ninja::eventVars(auth()->user()->id)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,7 +102,7 @@ class BaseRepository
|
|||||||
$className = $this->getEventClass($entity, 'Deleted');
|
$className = $this->getEventClass($entity, 'Deleted');
|
||||||
|
|
||||||
if (class_exists($className) && ! ($entity instanceof Company)) {
|
if (class_exists($className) && ! ($entity instanceof Company)) {
|
||||||
event(new $className($entity, $entity->company, Ninja::eventVars()));
|
event(new $className($entity, $entity->company, Ninja::eventVars(auth()->user()->id)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ class PaymentRepository extends BaseRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( ! $is_existing_payment && ! $this->import_mode ) {
|
if ( ! $is_existing_payment && ! $this->import_mode ) {
|
||||||
event( new PaymentWasCreated( $payment, $payment->company, Ninja::eventVars() ) );
|
event( new PaymentWasCreated( $payment, $payment->company, Ninja::eventVars(auth()->user()->id) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
nlog("payment amount = {$payment->amount}");
|
nlog("payment amount = {$payment->amount}");
|
||||||
@ -205,7 +205,7 @@ class PaymentRepository extends BaseRepository {
|
|||||||
|
|
||||||
$payment = $payment->service()->deletePayment();
|
$payment = $payment->service()->deletePayment();
|
||||||
|
|
||||||
event(new PaymentWasDeleted($payment, $payment->company, Ninja::eventVars()));
|
event(new PaymentWasDeleted($payment, $payment->company, Ninja::eventVars(auth()->user()->id)));
|
||||||
|
|
||||||
return $payment;
|
return $payment;
|
||||||
//return parent::delete($payment);
|
//return parent::delete($payment);
|
||||||
|
@ -123,7 +123,7 @@ class UserRepository extends BaseRepository
|
|||||||
$cu->forceDelete();
|
$cu->forceDelete();
|
||||||
}
|
}
|
||||||
|
|
||||||
event(new UserWasDeleted($user, $company, Ninja::eventVars()));
|
event(new UserWasDeleted($user, $company, Ninja::eventVars(auth()->user()->id)));
|
||||||
|
|
||||||
$user->delete();
|
$user->delete();
|
||||||
|
|
||||||
@ -146,7 +146,7 @@ class UserRepository extends BaseRepository
|
|||||||
$cu->delete();
|
$cu->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
event(new UserWasDeleted($user, auth()->user(), $company, Ninja::eventVars()));
|
event(new UserWasDeleted($user, auth()->user(), $company, Ninja::eventVars(auth()->user()->id)));
|
||||||
|
|
||||||
$user->is_deleted = true;
|
$user->is_deleted = true;
|
||||||
$user->save();
|
$user->save();
|
||||||
@ -164,7 +164,7 @@ class UserRepository extends BaseRepository
|
|||||||
|
|
||||||
$user->delete();
|
$user->delete();
|
||||||
|
|
||||||
event(new UserWasArchived($user, auth()->user(), auth()->user()->company, Ninja::eventVars()));
|
event(new UserWasArchived($user, auth()->user(), auth()->user()->company, Ninja::eventVars(auth()->user()->id)));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,7 +189,7 @@ class UserRepository extends BaseRepository
|
|||||||
|
|
||||||
$cu->restore();
|
$cu->restore();
|
||||||
|
|
||||||
event(new UserWasRestored($user, auth()->user(), auth()->user()->company, Ninja::eventVars()));
|
event(new UserWasRestored($user, auth()->user(), auth()->user()->company, Ninja::eventVars(auth()->user()->id)));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -144,11 +144,11 @@ class ApplyPayment
|
|||||||
->ledger()
|
->ledger()
|
||||||
->updateCreditBalance(($this->amount_applied * -1), "Credit payment applied to Invoice {$this->invoice->number}");
|
->updateCreditBalance(($this->amount_applied * -1), "Credit payment applied to Invoice {$this->invoice->number}");
|
||||||
|
|
||||||
event(new InvoiceWasUpdated($this->invoice, $this->invoice->company, Ninja::eventVars()));
|
event(new InvoiceWasUpdated($this->invoice, $this->invoice->company, Ninja::eventVars(auth()->user()->id)));
|
||||||
|
|
||||||
if ((int)$this->invoice->balance == 0) {
|
if ((int)$this->invoice->balance == 0) {
|
||||||
$this->invoice->service()->deletePdf();
|
$this->invoice->service()->deletePdf();
|
||||||
event(new InvoiceWasPaid($this->invoice, $payment, $this->payment->company, Ninja::eventVars()));
|
event(new InvoiceWasPaid($this->invoice, $payment, $this->payment->company, Ninja::eventVars(auth()->user()->id)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ class MarkSent
|
|||||||
|
|
||||||
$this->credit->markInvitationsSent();
|
$this->credit->markInvitationsSent();
|
||||||
|
|
||||||
event(new CreditWasMarkedSent($this->credit, $this->credit->company, Ninja::eventVars()));
|
event(new CreditWasMarkedSent($this->credit, $this->credit->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||||
|
|
||||||
$this->credit
|
$this->credit
|
||||||
->service()
|
->service()
|
||||||
|
@ -50,7 +50,7 @@ class HandleCancellation extends AbstractService
|
|||||||
//adjust client balance
|
//adjust client balance
|
||||||
$this->invoice->client->service()->updateBalance($adjustment)->save();
|
$this->invoice->client->service()->updateBalance($adjustment)->save();
|
||||||
|
|
||||||
event(new InvoiceWasCancelled($this->invoice, $this->invoice->company, Ninja::eventVars()));
|
event(new InvoiceWasCancelled($this->invoice, $this->invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||||
|
|
||||||
return $this->invoice;
|
return $this->invoice;
|
||||||
}
|
}
|
||||||
|
@ -81,8 +81,8 @@ class MarkPaid extends AbstractService
|
|||||||
$payment->service()->sendEmail();
|
$payment->service()->sendEmail();
|
||||||
|
|
||||||
/* Update Invoice balance */
|
/* Update Invoice balance */
|
||||||
event(new PaymentWasCreated($payment, $payment->company, Ninja::eventVars()));
|
event(new PaymentWasCreated($payment, $payment->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||||
event(new InvoiceWasPaid($this->invoice, $payment, $payment->company, Ninja::eventVars()));
|
event(new InvoiceWasPaid($this->invoice, $payment, $payment->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||||
|
|
||||||
$payment->ledger()
|
$payment->ledger()
|
||||||
->updatePaymentBalance($payment->amount * -1);
|
->updatePaymentBalance($payment->amount * -1);
|
||||||
|
@ -54,7 +54,7 @@ class MarkSent extends AbstractService
|
|||||||
|
|
||||||
$this->invoice->ledger()->updateInvoiceBalance($this->invoice->balance, "Invoice {$this->invoice->number} marked as sent.");
|
$this->invoice->ledger()->updateInvoiceBalance($this->invoice->balance, "Invoice {$this->invoice->number} marked as sent.");
|
||||||
|
|
||||||
event(new InvoiceWasUpdated($this->invoice, $this->invoice->company, Ninja::eventVars()));
|
event(new InvoiceWasUpdated($this->invoice, $this->invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||||
|
|
||||||
return $this->invoice->fresh();
|
return $this->invoice->fresh();
|
||||||
}
|
}
|
||||||
|
@ -112,10 +112,10 @@ class RefundPayment
|
|||||||
if (isset($this->refund_data['invoices'])) {
|
if (isset($this->refund_data['invoices'])) {
|
||||||
foreach ($this->refund_data['invoices'] as $invoice) {
|
foreach ($this->refund_data['invoices'] as $invoice) {
|
||||||
$fields->invoice_id = $invoice['invoice_id'];
|
$fields->invoice_id = $invoice['invoice_id'];
|
||||||
$activity_repo->save($fields, $this->payment, Ninja::eventVars());
|
$activity_repo->save($fields, $this->payment, Ninja::eventVars(auth()->user()->id));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$activity_repo->save($fields, $this->payment, Ninja::eventVars());
|
$activity_repo->save($fields, $this->payment, Ninja::eventVars(auth()->user()->id));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -45,7 +45,7 @@ class MarkSent
|
|||||||
$this->quote->due_date = Carbon::parse($this->quote->date)->addDays($this->quote->client->getSetting('valid_until'));
|
$this->quote->due_date = Carbon::parse($this->quote->date)->addDays($this->quote->client->getSetting('valid_until'));
|
||||||
}
|
}
|
||||||
|
|
||||||
event(new QuoteWasMarkedSent($this->quote, $this->quote->company, Ninja::eventVars()));
|
event(new QuoteWasMarkedSent($this->quote, $this->quote->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||||
|
|
||||||
$this->quote
|
$this->quote
|
||||||
->service()
|
->service()
|
||||||
|
@ -111,12 +111,13 @@ class Ninja
|
|||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function eventVars()
|
public static function eventVars($user_id = null)
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'ip' => request()->getClientIp(),
|
'ip' => request()->getClientIp(),
|
||||||
'token' => request()->header('X-API-TOKEN'),
|
'token' => request()->header('X-API-TOKEN'),
|
||||||
'is_system' => app()->runningInConsole(),
|
'is_system' => app()->runningInConsole(),
|
||||||
|
'user_id' => $user_id,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,10 +211,10 @@ trait Refundable
|
|||||||
foreach ($data['invoices'] as $invoice) {
|
foreach ($data['invoices'] as $invoice) {
|
||||||
$fields->invoice_id = $invoice->id;
|
$fields->invoice_id = $invoice->id;
|
||||||
|
|
||||||
$activity_repo->save($fields, $this, Ninja::eventVars());
|
$activity_repo->save($fields, $this, Ninja::eventVars(auth()->user()->id));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$activity_repo->save($fields, $this, Ninja::eventVars());
|
$activity_repo->save($fields, $this, Ninja::eventVars(auth()->user()->id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,9 +77,9 @@
|
|||||||
"brianium/paratest": "^6.1",
|
"brianium/paratest": "^6.1",
|
||||||
"darkaonline/l5-swagger": "^8.0",
|
"darkaonline/l5-swagger": "^8.0",
|
||||||
"facade/ignition": "^2.3.6",
|
"facade/ignition": "^2.3.6",
|
||||||
|
"fakerphp/faker": "^1.14",
|
||||||
"filp/whoops": "^2.7",
|
"filp/whoops": "^2.7",
|
||||||
"friendsofphp/php-cs-fixer": "^2.16",
|
"friendsofphp/php-cs-fixer": "^2.16",
|
||||||
"fakerphp/faker": "^1.14",
|
|
||||||
"mockery/mockery": "^1.3.1",
|
"mockery/mockery": "^1.3.1",
|
||||||
"nunomaduro/collision": "^5.0",
|
"nunomaduro/collision": "^5.0",
|
||||||
"phpunit/phpunit": "^9.0",
|
"phpunit/phpunit": "^9.0",
|
||||||
|
159
composer.lock
generated
159
composer.lock
generated
@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "56b8467dfddd19762a9124d0624a5003",
|
"content-hash": "7ccb8d2434343dfb0ba62866f0ee919a",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "authorizenet/authorizenet",
|
"name": "authorizenet/authorizenet",
|
||||||
@ -11718,6 +11718,103 @@
|
|||||||
],
|
],
|
||||||
"time": "2021-01-25T15:34:13+00:00"
|
"time": "2021-01-25T15:34:13+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "nunomaduro/larastan",
|
||||||
|
"version": "v0.7.3",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/nunomaduro/larastan.git",
|
||||||
|
"reference": "9c515d46851dca5a99fc82c0a69392c362b7affd"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/nunomaduro/larastan/zipball/9c515d46851dca5a99fc82c0a69392c362b7affd",
|
||||||
|
"reference": "9c515d46851dca5a99fc82c0a69392c362b7affd",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"composer/composer": "^1.0 || ^2.0",
|
||||||
|
"ext-json": "*",
|
||||||
|
"illuminate/console": "^6.0 || ^7.0 || ^8.0 || ^9.0",
|
||||||
|
"illuminate/container": "^6.0 || ^7.0 || ^8.0 || ^9.0",
|
||||||
|
"illuminate/contracts": "^6.0 || ^7.0 || ^8.0 || ^9.0",
|
||||||
|
"illuminate/database": "^6.0 || ^7.0 || ^8.0 || ^9.0",
|
||||||
|
"illuminate/http": "^6.0 || ^7.0 || ^8.0 || ^9.0",
|
||||||
|
"illuminate/pipeline": "^6.0 || ^7.0 || ^8.0 || ^9.0",
|
||||||
|
"illuminate/support": "^6.0 || ^7.0 || ^8.0 || ^9.0",
|
||||||
|
"mockery/mockery": "^0.9 || ^1.0",
|
||||||
|
"php": "^7.2 || ^8.0",
|
||||||
|
"phpstan/phpstan": "^0.12.83",
|
||||||
|
"symfony/process": "^4.3 || ^5.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"orchestra/testbench": "^4.0 || ^5.0 || ^6.0 || ^7.0",
|
||||||
|
"phpunit/phpunit": "^7.3 || ^8.2 || ^9.3"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"orchestra/testbench": "^4.0 || ^5.0"
|
||||||
|
},
|
||||||
|
"type": "phpstan-extension",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "0.6-dev"
|
||||||
|
},
|
||||||
|
"phpstan": {
|
||||||
|
"includes": [
|
||||||
|
"extension.neon"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"NunoMaduro\\Larastan\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Nuno Maduro",
|
||||||
|
"email": "enunomaduro@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Larastan - Discover bugs in your code without running it. A phpstan/phpstan wrapper for Laravel",
|
||||||
|
"keywords": [
|
||||||
|
"PHPStan",
|
||||||
|
"code analyse",
|
||||||
|
"code analysis",
|
||||||
|
"larastan",
|
||||||
|
"laravel",
|
||||||
|
"package",
|
||||||
|
"php",
|
||||||
|
"static analysis"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/nunomaduro/larastan/issues",
|
||||||
|
"source": "https://github.com/nunomaduro/larastan/tree/v0.7.3"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=66BYDWAT92N6L",
|
||||||
|
"type": "custom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://github.com/canvural",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://github.com/nunomaduro",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://www.patreon.com/nunomaduro",
|
||||||
|
"type": "patreon"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2021-04-12T11:01:46+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "openlss/lib-array2xml",
|
"name": "openlss/lib-array2xml",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
@ -12162,6 +12259,66 @@
|
|||||||
},
|
},
|
||||||
"time": "2021-03-17T13:42:18+00:00"
|
"time": "2021-03-17T13:42:18+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "phpstan/phpstan",
|
||||||
|
"version": "0.12.83",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/phpstan/phpstan.git",
|
||||||
|
"reference": "4a967cec6efb46b500dd6d768657336a3ffe699f"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/4a967cec6efb46b500dd6d768657336a3ffe699f",
|
||||||
|
"reference": "4a967cec6efb46b500dd6d768657336a3ffe699f",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": "^7.1|^8.0"
|
||||||
|
},
|
||||||
|
"conflict": {
|
||||||
|
"phpstan/phpstan-shim": "*"
|
||||||
|
},
|
||||||
|
"bin": [
|
||||||
|
"phpstan",
|
||||||
|
"phpstan.phar"
|
||||||
|
],
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "0.12-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"files": [
|
||||||
|
"bootstrap.php"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"description": "PHPStan - PHP Static Analysis Tool",
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/phpstan/phpstan/issues",
|
||||||
|
"source": "https://github.com/phpstan/phpstan/tree/0.12.83"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://github.com/ondrejmirtes",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://www.patreon.com/phpstan",
|
||||||
|
"type": "patreon"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan",
|
||||||
|
"type": "tidelift"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2021-04-03T15:35:45+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/php-code-coverage",
|
"name": "phpunit/php-code-coverage",
|
||||||
"version": "9.2.6",
|
"version": "9.2.6",
|
||||||
|
@ -4203,6 +4203,12 @@ $LANG = array(
|
|||||||
'promo_code' => 'Promo code',
|
'promo_code' => 'Promo code',
|
||||||
'recurring_invoice_issued_to' => 'Recurring invoice issued to',
|
'recurring_invoice_issued_to' => 'Recurring invoice issued to',
|
||||||
'subscription' => 'Subscription',
|
'subscription' => 'Subscription',
|
||||||
|
|
||||||
|
'activity_80' => ':user created subscription :subscription',
|
||||||
|
'activity_81' => ':user updated subscription :subscription',
|
||||||
|
'activity_82' => ':user archived subscription :subscription',
|
||||||
|
'activity_83' => ':user deleted subscription :subscription',
|
||||||
|
'activity_84' => ':user restored subscription :subscription',
|
||||||
);
|
);
|
||||||
|
|
||||||
return $LANG;
|
return $LANG;
|
||||||
|
@ -41,6 +41,11 @@ use App\Events\Quote\QuoteWasCreated;
|
|||||||
use App\Events\Quote\QuoteWasDeleted;
|
use App\Events\Quote\QuoteWasDeleted;
|
||||||
use App\Events\Quote\QuoteWasRestored;
|
use App\Events\Quote\QuoteWasRestored;
|
||||||
use App\Events\Quote\QuoteWasUpdated;
|
use App\Events\Quote\QuoteWasUpdated;
|
||||||
|
use App\Events\Subscription\SubscriptionWasArchived;
|
||||||
|
use App\Events\Subscription\SubscriptionWasCreated;
|
||||||
|
use App\Events\Subscription\SubscriptionWasDeleted;
|
||||||
|
use App\Events\Subscription\SubscriptionWasRestored;
|
||||||
|
use App\Events\Subscription\SubscriptionWasUpdated;
|
||||||
use App\Events\Task\TaskWasArchived;
|
use App\Events\Task\TaskWasArchived;
|
||||||
use App\Events\Task\TaskWasCreated;
|
use App\Events\Task\TaskWasCreated;
|
||||||
use App\Events\Task\TaskWasDeleted;
|
use App\Events\Task\TaskWasDeleted;
|
||||||
@ -670,5 +675,61 @@ class EventTest extends TestCase
|
|||||||
->assertStatus(200);
|
->assertStatus(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testSubscriptionEvents()
|
||||||
|
{
|
||||||
|
$this->expectsEvents([
|
||||||
|
SubscriptionWasCreated::class,
|
||||||
|
SubscriptionWasUpdated::class,
|
||||||
|
SubscriptionWasArchived::class,
|
||||||
|
SubscriptionWasRestored::class,
|
||||||
|
SubscriptionWasDeleted::class,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'name' => $this->faker->firstName,
|
||||||
|
];
|
||||||
|
|
||||||
|
$response = $this->withHeaders([
|
||||||
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
|
'X-API-TOKEN' => $this->token,
|
||||||
|
])->post('/api/v1/subscriptions/', $data)
|
||||||
|
->assertStatus(200);
|
||||||
|
|
||||||
|
|
||||||
|
$arr = $response->json();
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'name' => $this->faker->firstName,
|
||||||
|
];
|
||||||
|
|
||||||
|
$response = $this->withHeaders([
|
||||||
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
|
'X-API-TOKEN' => $this->token,
|
||||||
|
])->put('/api/v1/subscriptions/' . $arr['data']['id'], $data)
|
||||||
|
->assertStatus(200);
|
||||||
|
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'ids' => [$arr['data']['id']],
|
||||||
|
];
|
||||||
|
|
||||||
|
$response = $this->withHeaders([
|
||||||
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
|
'X-API-TOKEN' => $this->token,
|
||||||
|
])->post('/api/v1/subscriptions/bulk?action=archive', $data)
|
||||||
|
->assertStatus(200);
|
||||||
|
|
||||||
|
$response = $this->withHeaders([
|
||||||
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
|
'X-API-TOKEN' => $this->token,
|
||||||
|
])->post('/api/v1/subscriptions/bulk?action=restore', $data)
|
||||||
|
->assertStatus(200);
|
||||||
|
|
||||||
|
$response = $this->withHeaders([
|
||||||
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
|
'X-API-TOKEN' => $this->token,
|
||||||
|
])->post('/api/v1/subscriptions/bulk?action=delete', $data)
|
||||||
|
->assertStatus(200);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user