Validação 1

É importante validar o input do usuário.

<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class CreateUserRequest extends FormRequest
{
  public function rules(): array
  {
    return [
      'email' => 'required|unique:users,email,' . $this->email,
      'password' => 'required|string|max:128',
    ];
  }
}