canDo('concern.concern.view') && $authUser->isAdmin()) { return true; } return $concern->user_id == user_id() && $concern->user_type == user_type(); } /** * Determine if the given user can create a concern. * * @param UserPolicyInterface $authUser * * @return bool */ public function create(UserPolicyInterface $authUser) { return $authUser->canDo('concern.concern.create'); } /** * Determine if the given user can update the given concern. * * @param UserPolicyInterface $authUser * @param Concern $concern * * @return bool */ public function update(UserPolicyInterface $authUser, Concern $concern) { if ($authUser->canDo('concern.concern.edit') && $authUser->isAdmin()) { return true; } return $concern->user_id == user_id() && $concern->user_type == user_type(); } /** * Determine if the given user can delete the given concern. * * @param UserPolicyInterface $authUser * * @return bool */ public function destroy(UserPolicyInterface $authUser, Concern $concern) { return $concern->user_id == user_id() && $concern->user_type == user_type(); } /** * Determine if the given user can verify the given concern. * * @param UserPolicyInterface $authUser * * @return bool */ public function verify(UserPolicyInterface $authUser, Concern $concern) { if ($authUser->canDo('concern.concern.verify')) { return true; } return false; } /** * Determine if the given user can approve the given concern. * * @param UserPolicyInterface $authUser * * @return bool */ public function approve(UserPolicyInterface $authUser, Concern $concern) { if ($authUser->canDo('concern.concern.approve')) { return true; } return false; } /** * Determine if the user can perform a given action ve. * * @param [type] $authUser [description] * @param [type] $ability [description] * * @return [type] [description] */ public function before($authUser, $ability) { if ($authUser->isSuperuser()) { return true; } } }