jeudi 29 mars 2018

How do I get the ID in my request validation

How can I get the ID from the request, if is a new register, I want it to be null or 0

I need this to do custons validations, one validation for create and another for update

that is my Request

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

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'nome' => 'required|max:255',
            'url' => 'required',
        ];
    }

    public function messages()
    {
        return [
            'nome.required' => 'O nome é obrigatório',
            'nome.max' => 'O tamanho máximo para nome é de 255 caracteres',
            'url.required' => 'A URL é obrigatória',
        ];
    }
}



from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2If5hy6
via IFTTT

Aucun commentaire:

Enregistrer un commentaire