Devraj
Devraj

Reputation: 71

how to secure route when storing form data using laravel?

When I save the form data to database using laravel it works fine. I used the reference from http://www.studentstutorial.com/laravel/insert-data-laravel.php to store the data to the database. But when I directly enter the url localhost:8000/create manually it throws exception.

Upvotes: 0

Views: 260

Answers (1)

TalESid
TalESid

Reputation: 2514

As your route is /create, most probably its a "POST" route and the code at the given link shows that this route is POST method (as expected). POST routes can't open directly in browser, only GET routes can.

Routes given at the link:

Route::get('insert','StudInsertController@insertform');
Route::post('create','StudInsertController@insert'); 

You can test 1st route i.e. localhost:8000/insert as its a GET route. 2nd route is POST, it can't be tested directly in browser. Test your post routes in API testing tools like "Postman".

Upvotes: 1

Related Questions