canDo('video.video_uploading.view') && $user->isAdmin()) { return true; } return $video_uploading->user_id == user_id() && $video_uploading->user_type == user_type(); } /** * Determine if the given user can create a video_uploading. * * @param UserPolicy $user * @param VideoUploading $video_uploading * * @return bool */ public function create(UserPolicy $user) { return $user->canDo('video.video_uploading.create'); } /** * Determine if the given user can update the given video_uploading. * * @param UserPolicy $user * @param VideoUploading $video_uploading * * @return bool */ public function update(UserPolicy $user, VideoUploading $video_uploading) { if ($user->canDo('video.video_uploading.edit') && $user->isAdmin()) { return true; } return $video_uploading->user_id == user_id() && $video_uploading->user_type == user_type(); } /** * Determine if the given user can delete the given video_uploading. * * @param UserPolicy $user * @param VideoUploading $video_uploading * * @return bool */ public function destroy(UserPolicy $user, VideoUploading $video_uploading) { return $video_uploading->user_id == user_id() && $video_uploading->user_type == user_type(); } /** * Determine if the given user can verify the given video_uploading. * * @param UserPolicy $user * @param VideoUploading $video_uploading * * @return bool */ public function verify(UserPolicy $user, VideoUploading $video_uploading) { if ($user->canDo('video.video_uploading.verify')) { return true; } return false; } /** * Determine if the given user can approve the given video_uploading. * * @param UserPolicy $user * @param VideoUploading $video_uploading * * @return bool */ public function approve(UserPolicy $user, VideoUploading $video_uploading) { if ($user->canDo('video.video_uploading.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; } } }