master

laravel/framework

Last updated at: 28/12/2023 01:39

request.stub

TLDR

This file is a PHP stub file for generating a form request class. It contains a class {{ class }} that extends the FormRequest class from the Illuminate\Foundation\Http namespace. The class has two methods: authorize() and rules().

Methods

authorize()

This method determines if the user is authorized to make the request. It returns a boolean value.

rules()

This method returns an array of validation rules that apply to the request. The array can contain strings, arrays, or instances of validation rules.

<?php

namespace {{ namespace }};

use Illuminate\Foundation\Http\FormRequest;

class {{ class }} extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return false;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
     */
    public function rules(): array
    {
        return [
            //
        ];
    }
}