canDo('media_request.media_request.view') && $user->isAdmin()) { return true; } return $media_request->user_id == user_id() && $media_request->user_type == user_type(); } /** * Determine if the given user can create a media_request. * * @param UserPolicy $user * @param MediaRequest $media_request * * @return bool */ public function create(UserPolicy $user) { return $user->canDo('media_request.media_request.create'); } /** * Determine if the given user can update the given media_request. * * @param UserPolicy $user * @param MediaRequest $media_request * * @return bool */ public function update(UserPolicy $user, MediaRequest $media_request) { if ($user->canDo('media_request.media_request.edit') && $user->isAdmin()) { return true; } return $media_request->user_id == user_id() && $media_request->user_type == user_type(); } /** * Determine if the given user can delete the given media_request. * * @param UserPolicy $user * @param MediaRequest $media_request * * @return bool */ public function destroy(UserPolicy $user, MediaRequest $media_request) { return $media_request->user_id == user_id() && $media_request->user_type == user_type(); } /** * Determine if the given user can verify the given media_request. * * @param UserPolicy $user * @param MediaRequest $media_request * * @return bool */ public function verify(UserPolicy $user, MediaRequest $media_request) { if ($user->canDo('media_request.media_request.verify')) { return true; } return false; } /** * Determine if the given user can approve the given media_request. * * @param UserPolicy $user * @param MediaRequest $media_request * * @return bool */ public function approve(UserPolicy $user, MediaRequest $media_request) { if ($user->canDo('media_request.media_request.approve')) { return true; } return false; } /** * Determine if the user can perform a given action ve. * * @param [type] $user [description] * @param [type] $ability [description] * * @return [type] [description] */ public function before($user, $ability) { if ($user->isSuperuser()) { return true; } } }