Laravel validation: exists with additional column condition – custom validation rule

From Laravel 5.3+ you can add a custom where clause to the exists and unique rules. Here is my scenario: I have an email verification table and I want to ensure that a passed machine code and activation code exist on the same row. Be sure to use Illuminate\Validation\Rule; $activationCode = $request->activation_code; $rules = [ … Read more

Custom Laravel validation messages

Laravel 5.7.* Also You can try something like this. For me is the easiest way to make custom messages in methods when you want to validate requests: public function store() { request()->validate([ ‘file’ => ‘required’, ‘type’ => ‘required’ ], [ ‘file.required’ => ‘You have to choose the file!’, ‘type.required’ => ‘You have to choose type … Read more

Undefined variable: errors in Laravel

You should make sure that in app/Http/Kernel.php in middlewareGroups property for web you have: \Illuminate\View\Middleware\ShareErrorsFromSession::class, in this array. Compare this with https://github.com/laravel/laravel/blob/master/app/Http/Kernel.php EDIT It seems you need to add ‘middleware’ => ‘web’ for route you are using or put \Illuminate\View\Middleware\ShareErrorsFromSession::class, into $middleware property array or Inside of the routes.php file try to create your routes … Read more