vbevdev
6 months ago
112
3
General

Empty $errors in blade template

Posted 6 months ago by vbevdev

Hi everyone!

I'm new to Laravel so I'm watching this nice course "Laravel 5.7 From Scratch". Everything go well but I have some strange issue that I can't figure out by myself.

In this lesson https://laracasts.com/series/laravel-from-scratch-2018/episodes/15 I need to use validation for my create form. I repeat for the teacher but my errors doesn't showing.

I have a controller and a method store(), all like in the video.

Store method:

public function store()
 {
        request()->validate([
            'title' => 'required',
            'description' => 'required'
        ]);

        Project::create(request(['title', 'description']));

        return redirect('/projects');
    }

I think that validation work cause I'm redirecting to the same route /projects/create but my $errors variable is empty. If I var_dump it then it looks like so:

object(Illuminate\Support\ViewErrorBag)#204 (1) { ["bags":protected]=> array(0) { } }

Any assistance?

Please sign in or create an account to participate in this conversation.