Laravel Dry Requests is an amazing package that allows you to check if your requests would pass validation if you executed them normally. The Laravel equivalent of --dry-run in various CLI tools, or what some devs call "preflight requests".
Option 2 - using validate method on the Request object class UserController { public function store(Request $request): UserResource { $validated = $request->validate([ 'email' => ['required', 'email', 'max:255', 'unique:users'], 'username' => ['required', 'string', 'min:2', 'max:255', 'unique:users'], 'nickname' => ['nullable', 'string', 'min:2', 'max:255'], ]); $user = User::create($request->validated()); return new UserResource($user); }}
// Successful unique username check: Controller did not execute axios.post('/users', { username: 'Asil Kan' }, { headers: { 'X-Dry-Run': true }}) .then(response => response.status); // 200 OK