samedi 27 octobre 2018

Can not get my data from my form in Laravel?

I am new to Laravel, I am trying to have a simple example, but I am getting a 419 error, I dont know why it shows up but I will expalin what I did, I created a simple Controller and I called it FormController with the command line :

 php artisan make:controller --resource FormController

In my web.php I added this :

Route::resource('form','FormController');

my view has a simple form in it :

<form action="/form" method="POST" >
   <input type="text" name="cih">
   <input type="submit">
</form>

I open my view with the create method :

public function create()
{
    return view('contact');
}

I want that when I submit my form I get my data, so I use my 'store' method :

public function store(Request $request)
{
    return $request->all();
}

But instead of getting it, I get 419 message, and my session has expired etc ..

I followed a course and that what the teacher was doing I believe nothing more, so I would appreciate any help, I need it.

Thank you



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire