Learn laravel web from scratch (3)

The time has been delayed for a long time, let’s not talk about it. After starting, try to talk as little as possible. Learning laravel combined with the official documentation is faster. There is also a Chinese called laravel academy http://laravelacademy.org/

Okay, let’s start directly. We have already created the underlying things. Now we can start to write the code directly. Let’s say that the web.php routing file has get, post, delete, any, patch, options.


These routes can all carry parameters such as Route::get('/test/{'id'}').....and so on, of course, we can also import the command space and group the routes, which will be Mentioned

To start directly, we need to do a login and registration function, it is impossible to create all our information in the database

1. Create a route


Why don’t we use get here? When we log in, we need to get the landing page and then submit. According to the traditional mode, we need to get get first and then post to submit. Here any already includes get and post, and it will automatically recognize it. The way we requested, after the creation is complete, we need to assign the view, the bootstrap we use, forgive me for being a front-end rookie, I can only copy others (555555)

The second is to define the method in the method controller and assign it to the view



After we have defined the method, use the return view() method to return to the page. The admin.index inside is the corresponding views/admin/index.blade.php page. Laravel uses the blade template engine by default, so every page is So after the allocation of *.blade.php is finished, we need some html code,

This will not introduce the method of using bootstrap



This is the request of the entire website. From the creation of the route -> to the controller -> the view is complete. Due to the limited style level, the page has not been processed. I hope you understand.


Guess you like

Origin blog.csdn.net/mzjmc123/article/details/75511405