[Laravel] Laravel development skills-php Tutorial

Source: Internet
Author: User
[Laravel] introduction to Laravel development skills

In the past few days, I have been using laravel to write a blog website, and some problems are inevitable during the development process. this blog post is a summary of some common skills.

Body

1. laravel logon registration page, you can directly use the command

phpartisanmake:auth  

Using this command, laravel will automatically generate a series of files including Views, routes, controllers, and so on. all you need to do is to merge the views into your project.

After successful login and logout, laravel will automatically jump to some pages for you. you can also customize the pages you want to jump. In AuthController, we set the $ redirectAfterLogout field and $ redirectTo field to specify the redirection URL after login and exit.

2. laravel specifies the directory creation controller, which should be

phpartisanmake:controllerAdmin/PostController 

Instead of naming

  phpartisanmake:controller /Admin/PostController 

3. when using Laravel's own Auth verification system, pay attention to the following common methods: Auth: check (), Auth: guest (), Auth: guard (), Auth :: logout ()

4. for laravel debugging, you can use the dd () function or the Log facade that comes with laravel. For debugging problems, please refer to this blog https://segmentfault.com/n/1330000003808496

5. laravel's common development tools and extension packages (Declaration: I may not have used them as my favorites)

Jenssegers/agent-easily identifies client information

Steven yangecho/laravel-u-editor -- Baidu editor

Overtrue/laravel-lang -- language packs in multiple countries of laravel

Predis/predis -- the best redis-php extension package

Teepluss/theme-theme and resource management

Eternicode/bootstrap-datepicker -- date selector designed for Bootstrap

Anahkiasen/former-a powerful form builder independent of Laravel

6. laravel uses Bower + Gulp to integrate front-end resources. after talking about the many tools and expansion packages above, laravel always talks about why it is used. first, Bower is a front-end package management tool, just like the Composer when Laravel is installed, if you use Bower to introduce Bootstrap, you may see the Less file, in my understanding, Less is a pre-compiled language between css and js, which can help you quickly define html styles. Finally, let's talk about Gulp. Gulp is a job management tool. why do we need to use Gulp instead of directly introducing these files? In my understanding, the introduction of Gulp can help you improve efficiency in large projects!

As for how to use, you can refer to this blog http://laravelacademy.org/post/2299.html

And videos from geek College.

7. the paging function of laravel is very simple to implement laravel paging. here I will introduce the paginate method based on the Eloquent model and the Eloquent model, this method automatically sets the appropriate offset and limit based on the current user view page ). By default, the current page queries string parameters through HTTP requests? Page value judgment. Of course, this value is automatically detected by Laravel, and then automatically inserted into the link generated by the page Sharer. After calling the paginate function, you can call the render () method from the Blade template in the view to implement paging.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.