departments->where('id', '=', $course->dept_id)->isNotEmpty() || $user->faculties->where('id', '=', $course->faculty->id)->isNotEmpty(); } /** * Determine whether the user can delete the course. * * @param \App\User $user * @param \App\Course $course * @return mixed */ public function delete(User $user, Course $course) { return $user->departments->where('id', '=', $course->dept_id)->isNotEmpty() || $user->faculties->where('id', '=', $course->faculty->id)->isNotEmpty(); } }