CourseWork/app/Policies/SubjectPolicy.php
m.zargarov c7fefd138a Fix
2024-06-25 00:52:48 +04:00

51 lines
1.1 KiB
PHP

<?php
namespace App\Policies;
use App\Models\Admin;
use App\Models\Student;
use App\Models\Subject;
use App\Models\Teacher;
use App\Models\User;
class SubjectPolicy
{
public function viewAny(User $user): bool
{
return $user->userable_type != Teacher::class;
}
/**
* 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;
}
public function scores(User $user, Subject $subject): bool
{
return $user->userable_type == Student::class;
}
public function pdf(User $user): bool
{
return $user->userable_type == Student::class;
}
}