Example of Form requests in savannabits/charaza-ui

File app/Http/Requests/Api/User/StoreUser.php (link to Github)
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Gate;
use Illuminate\Validation\Rule;

class StoreUser extends FormRequest
    public function authorize(): bool
        return Gate::allows('users.create');

    public function rules(): array
        return [
            'name' => ['required', 'string'],
            'first_name' => ['required', 'string'],
            'last_name' => ['required', 'string'],
            'middle_name' => ['nullable', 'string'],
            'username' => ['required', Rule::unique('users', 'username'), 'string'],
            'email' => ['required', 'email', Rule::unique('users', 'email'), 'string'],
            'password' => ['nullable', 'confirmed', 'min:7', 'regex:/^.*(?=.{3,})(?=.*[a-zA-Z])(?=.*[0-9]).*$/', 'string'],
            'email_verified_at' => ['nullable', 'date'],

    public function sanitizedArray(): array
        $sanitized = $this->validated();

        //Add your code for manipulation with request data here

        return $sanitized;

    public function sanitizedObject(): object {
        $sanitized = $this->sanitizedArray();
        return json_decode(collect($sanitized));

Additional resources on Form requests: