'required', 'mobile_number' => 'required|numeric|digits:10', 'email' => 'required|email', 'subject' => 'required', 'message' => 'required', 'type' => 'required', 'representative_name' => 'nullable', ]; } /** * Get the error messages for the defined validation rules. * * @return array */ public function messages() { return [ 'required' => 'The :attribute field is required.', 'numeric' => 'The :attribute field must be in digits', 'digits' => 'The :attribute field must have 10 digits', ]; } public function validated() { if ($position = Location::get()) { $ipAddress = $position->ip; $location = $position->countryName; } // dd(auth('sanctum')->check()); $status = false; if(auth('sanctum')->check()) { $status = true; }else if(auth()->guard('users')->check()) { $status = true; } return array_merge(parent::validated(), [ 'location' => $location ?? null, 'ip_address' => $ipAddress ?? null, // 'page' => $user_id == true ? '1' : '0', 'page' => $status, ]); } }