35 lines
705 B
PHP
35 lines
705 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Policies;
|
||
|
|
||
|
use App\Models\Admin;
|
||
|
use App\Models\Subject;
|
||
|
use App\Models\User;
|
||
|
|
||
|
class SubjectPolicy
|
||
|
{
|
||
|
/**
|
||
|
* Determine whether the user can create models.
|
||
|
*/
|
||
|
public function create(User $user): bool
|
||
|
{
|
||
|
return $user->userable_type == Admin::class;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Determine whether the user can update the model.
|
||
|
*/
|
||
|
public function update(User $user, Subject $subject): bool
|
||
|
{
|
||
|
return $user->userable_type == Admin::class;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Determine whether the user can delete the model.
|
||
|
*/
|
||
|
public function delete(User $user, Subject $subject): bool
|
||
|
{
|
||
|
return $user->userable_type == Admin::class;
|
||
|
}
|
||
|
}
|