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