for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace App\Policies;
use App\Models\User;
use App\Models\Course;
use App\Policies\BasePolicy;
class CoursePolicy extends BasePolicy
{
/**
* Determine whether the user can view the course.
*
* @param \App\Models\User $user
* @param \App\Models\Course $course
* @return mixed
*/
public function view(User $user, Course $course)
return $user->hasRole('applicant') && $course->applicant->user->is($user);
}
* Determine whether the user can create courses.
public function create(User $user)
return $user->hasRole('applicant');
* Determine whether the user can update the course.
public function update(User $user, Course $course)
* Determine whether the user can delete the course.
public function delete(User $user, Course $course)