Files
dockergprompt/app/Policies/LegalDocumentPolicy.php
T
2026-09-01 09:22:30 -03:00

70 lines
1.5 KiB
PHP
Executable File

<?php
declare(strict_types=1);
namespace App\Policies;
use App\Models\LegalDocument;
use App\Models\User;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Auth\Access\Response;
class LegalDocumentPolicy
{
/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
return $user->role === 'superadmin';
}
/**
* Determine whether the user can view the model.
*/
public function view(User $user, LegalDocument $document): bool
{
return true;
}
/**
* Determine whether the user can create models.
*/
public function create(User $user): bool
{
return $user->role === 'superadmin';
}
/**
* Determine whether the user can update the model.
*/
public function update(User $user, LegalDocument $document): bool
{
return $user->role === 'superadmin';
}
/**
* Determine whether the user can delete the model.
*/
public function delete(User $user, LegalDocument $document): bool
{
return $user->role === 'superadmin';
}
/**
* Determine whether the user can restore the model.
*/
public function restore(User $user, LegalDocument $document): bool
{
return false;
}
/**
* Determine whether the user can permanently delete the model.
*/
public function forceDelete(User $user, LegalDocument $document): bool
{
return false;
}
}