check()) { return false; } /** @var \App\Models\User */ $user = auth()->user(); return $user->can('validateEstimate', $this->ticket); } /** * Prepare the data for validation. * * @return void */ protected function prepareForValidation() { $this->merge([ 'answer' => $this->status === 'accept' ]); } /** * Get the validation rules that apply to the request. * * @return array */ public function rules() { return [ 'status' => 'required|in:accept,refuse', 'answer' => 'required|boolean' ]; } }