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