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