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