12-05-2026 Frontend dev
This commit is contained in:
parent
405df0a122
commit
5b8bdf4182
779 changed files with 480564 additions and 6241 deletions
33
app/Policies/LegacyInvoicePolicy.php
Normal file
33
app/Policies/LegacyInvoicePolicy.php
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\Models\LegacyInvoice;
|
||||
use App\Models\User;
|
||||
|
||||
class LegacyInvoicePolicy
|
||||
{
|
||||
public function before(User $user): ?bool
|
||||
{
|
||||
return $user->is_super_admin ? true : null;
|
||||
}
|
||||
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return $user->canAccessCustomer();
|
||||
}
|
||||
|
||||
public function view(User $user, LegacyInvoice $legacyInvoice): bool
|
||||
{
|
||||
if ($user->canAccessAdmin()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return $legacyInvoice->user_id === $user->id;
|
||||
}
|
||||
|
||||
public function downloadPdf(User $user, LegacyInvoice $legacyInvoice): bool
|
||||
{
|
||||
return $this->view($user, $legacyInvoice);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue