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