SUBD_Transport_Company/app/Policies/WarehousePolicy.php

26 lines
552 B
PHP
Raw Normal View History

<?php
namespace App\Policies;
use App\Enums\RoleEnum;
use App\Models\User;
use App\Models\Warehouse;
class WarehousePolicy
{
public function update(User $user, Warehouse $warehouse)
{
return $warehouse->id == $user->warehouse_id && $user->role == RoleEnum::ADMIN;
}
public function create(User $user)
{
return $user->role == RoleEnum::ADMIN;
}
public function delete(User $user, Warehouse $warehouse)
{
return $warehouse->id == $user->warehouse_id && $user->role == RoleEnum::ADMIN;
}
}