user(); return $user->can('edit', $this->document); } public function rules() { return [ 'name' => 'sometimes', 'is_public' => 'sometimes|boolean', ]; } public function prepareForValidation() { $input = $this->all(); if(isset($input['is_public'])) { $input['is_public'] = $this->toBoolean($input['is_public']); } $this->replace($input); } }