CourseWork/app/Policies/GradePolicy.php

63 lines
1.3 KiB
PHP
Raw Normal View History

2024-06-22 23:59:16 +04:00
<?php
namespace App\Policies;
use App\Models\Admin;
use App\Models\Grade;
use App\Models\Student;
2024-06-24 01:28:58 +04:00
use App\Models\Teacher;
2024-06-22 23:59:16 +04:00
use App\Models\User;
class GradePolicy
{
/**
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
return $user->userable_type != Student::class;
}
/**
* Determine whether the user can view the model.
*/
public function view(User $user, Grade $grade): bool
{
return $user->userable_type != Student::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, Grade $grade): bool
{
return $user->userable_type == Admin::class;
}
/**
* Determine whether the user can delete the model.
*/
public function delete(User $user, Grade $grade): bool
{
return $user->userable_type == Admin::class;
}
2024-06-24 01:28:58 +04:00
public function journal(User $user)
{
return $user->userable_type == Teacher::class;
}
public function list(User $user)
{
return $user->userable_type == Teacher::class;
}
2024-06-22 23:59:16 +04:00
}