2022-09-20 19:59:52 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Policies\Integration;
|
|
|
|
|
|
|
|
use App\Models\Integration\FormZapierWebhook;
|
|
|
|
use App\Models\User;
|
|
|
|
use App\Policies\FormPolicy;
|
|
|
|
use Illuminate\Auth\Access\HandlesAuthorization;
|
|
|
|
|
|
|
|
class FormZapierWebhookPolicy
|
|
|
|
{
|
|
|
|
use HandlesAuthorization;
|
|
|
|
|
|
|
|
protected FormPolicy $formPolicy;
|
|
|
|
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
$this->formPolicy = new FormPolicy();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function store(User $user, FormZapierWebhook $webhook)
|
|
|
|
{
|
2023-04-28 09:33:16 +00:00
|
|
|
return ($webhook?->form) ? $this->formPolicy->update($user, $webhook->form) : false; // && $user->is_subscribed;
|
2022-09-20 19:59:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function delete(User $user, FormZapierWebhook $webhook)
|
|
|
|
{
|
2023-04-28 09:33:16 +00:00
|
|
|
return ($webhook?->form) ? $this->formPolicy->update($user, $webhook->form) : false; // && $user->is_subscribed;
|
2022-09-20 19:59:52 +00:00
|
|
|
}
|
|
|
|
}
|