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