mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
fix for seeders
This commit is contained in:
parent
8a8c3b85c3
commit
ef48bd150c
@ -11,7 +11,9 @@
|
|||||||
|
|
||||||
namespace App\Observers;
|
namespace App\Observers;
|
||||||
|
|
||||||
|
use App\Jobs\Util\WebhookHandler;
|
||||||
use App\Models\Product;
|
use App\Models\Product;
|
||||||
|
use App\Models\Webhook;
|
||||||
|
|
||||||
class ProductObserver
|
class ProductObserver
|
||||||
{
|
{
|
||||||
@ -24,8 +26,8 @@ class ProductObserver
|
|||||||
public function created(Product $product)
|
public function created(Product $product)
|
||||||
{
|
{
|
||||||
$subscriptions = Webhook::where('company_id', $product->company->id)
|
$subscriptions = Webhook::where('company_id', $product->company->id)
|
||||||
->where('event_id', Webhook::EVENT_CREATE_PRODUCT)
|
->where('event_id', Webhook::EVENT_CREATE_PRODUCT)
|
||||||
->exists();
|
->exists();
|
||||||
|
|
||||||
if ($subscriptions) {
|
if ($subscriptions) {
|
||||||
WebhookHandler::dispatch(Webhook::EVENT_CREATE_PRODUCT, $product, $product->company)->delay(now()->addSeconds(2));
|
WebhookHandler::dispatch(Webhook::EVENT_CREATE_PRODUCT, $product, $product->company)->delay(now()->addSeconds(2));
|
||||||
@ -41,8 +43,8 @@ class ProductObserver
|
|||||||
public function updated(Product $product)
|
public function updated(Product $product)
|
||||||
{
|
{
|
||||||
$subscriptions = Webhook::where('company_id', $product->company->id)
|
$subscriptions = Webhook::where('company_id', $product->company->id)
|
||||||
->where('event_id', Webhook::EVENT_UPDATE_PRODUCT)
|
->where('event_id', Webhook::EVENT_UPDATE_PRODUCT)
|
||||||
->exists();
|
->exists();
|
||||||
|
|
||||||
if ($subscriptions) {
|
if ($subscriptions) {
|
||||||
WebhookHandler::dispatch(Webhook::EVENT_UPDATE_PRODUCT, $product, $product->company)->delay(now()->addSeconds(2));
|
WebhookHandler::dispatch(Webhook::EVENT_UPDATE_PRODUCT, $product, $product->company)->delay(now()->addSeconds(2));
|
||||||
@ -58,8 +60,8 @@ class ProductObserver
|
|||||||
public function deleted(Product $product)
|
public function deleted(Product $product)
|
||||||
{
|
{
|
||||||
$subscriptions = Webhook::where('company_id', $product->company->id)
|
$subscriptions = Webhook::where('company_id', $product->company->id)
|
||||||
->where('event_id', Webhook::EVENT_DELETE_PRODUCT)
|
->where('event_id', Webhook::EVENT_DELETE_PRODUCT)
|
||||||
->exists();
|
->exists();
|
||||||
|
|
||||||
if ($subscriptions) {
|
if ($subscriptions) {
|
||||||
WebhookHandler::dispatch(Webhook::EVENT_DELETE_PRODUCT, $product, $product->company)->delay(now()->addSeconds(2));
|
WebhookHandler::dispatch(Webhook::EVENT_DELETE_PRODUCT, $product, $product->company)->delay(now()->addSeconds(2));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user