Add policy for action events

This commit is contained in:
2023-12-08 10:45:01 +05:00
parent 374dfe8da1
commit a4265e488c
4 changed files with 96 additions and 8 deletions

View File

@@ -0,0 +1,74 @@
<?php
namespace App\Policies\System\Logs;
use Laravel\Nova\Actions\ActionEvent;
use App\Models\User;
use Illuminate\Auth\Access\Response;
class ActionEventPolicy
{
/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
if ($user->isAdmin()) {
return true;
}
return false;
}
/**
* Determine whether the user can view the model.
*/
public function view(User $user, ActionEvent $actionEvent): bool
{
if ($user->isAdmin()) {
return true;
}
return false;
}
/**
* Determine whether the user can create models.
*/
public function create(User $user): bool
{
return false;
}
/**
* Determine whether the user can update the model.
*/
public function update(User $user, ActionEvent $actionEvent): bool
{
return false;
}
/**
* Determine whether the user can delete the model.
*/
public function delete(User $user, ActionEvent $actionEvent): bool
{
return false;
}
/**
* Determine whether the user can restore the model.
*/
public function restore(User $user, ActionEvent $actionEvent): bool
{
return false;
}
/**
* Determine whether the user can permanently delete the model.
*/
public function forceDelete(User $user, ActionEvent $actionEvent): bool
{
return false;
}
}