Laravel

Laravel Custom validation messages

Pinterest LinkedIn Tumblr

Add code inside of your controller and make the function this easiest way to make custom messages in methods when you want to validate requests:

public function create()
{
    request()->validate([
        'name' => 'required',
        'description' => 'required'
    ],
    [
        'name.required' => 'A name is required',
        'description.required' => 'A description is required'
    ]);
}

Write A Comment

Faster PHP Cloud Hosting