How Control flow in Laravel

Route::get(‘task’,’TaskController@index’)->name(‘task’); Explanation:- name(‘task‘) is given in the URL as http://127.0.0.1:8000/task. Control flow:- As the URL is hit the control will go the route(web.php), there it will get Route::get(‘task’,’TaskController@index’)->name(‘task’); Here, there will be a name match from the URL and if there is match then there will be a function call named index and route will redirect to TaskController.php where it will find the function index and operate according to the instructions given inside it.

After the create operation we need to store the data in the database for this we used <form action=”{{route(‘store’)}}” method=”POST”> which will call store function. The store function be like

The in store function we create object $var of Task class make variables as $var->task which is assigned $request->task; (gets value from 1st field) & $var->detail which is assigned $request->detail; (gets value from 2nd field) and $var->save(); function will save it to the database.

abhishek k
Tagged : / / /
0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x