Answers for "laravel form request messages"

PHP
1

laravel make:request messages

public function rules()
{
    return [
        'title' => 'required|unique:posts|max:255',
        'body' => 'required',
    ];
}

public function messages()
{
    return [
        'title.required' => 'A title is required',
        'body.required' => 'A message is required',
    ];
}
Posted by: Guest on July-27-2021
1

how to add an custom error to validater error in laravel

if (request('event') == null) {
    $validator->errors()->add('event', 'Please select an event');
}
Posted by: Guest on October-20-2020

Code answers related to "laravel form request messages"

Browse Popular Code Answers by Language