[Laravel] Laravel Development Tips

Source: Internet
Author: User

Objective

These days the author in using Laravel write a blog site, in the development process inevitably encountered some problems, this blog post is about some of the common skills of the summary

Body

1.laravel Login Registration page, you can use the command directly

Phpartisanmake:auth  

Using this command, Laravel will automatically help you generate a series of files including views, routes, controllers, etc. all you have to do is 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 page you want to jump. In Authcontroller we set the $redirectAfterLogout field and the $redirectTo field to specify the redirect URL after login and exit

2.LARAVEL Specifies the directory to create the controller, which should be

Instead of naming as the following

  

3. When using the Laravel-Auth verification system, there are a few common methods to be aware of Auth::check (), Auth::guest (), Auth::guard (), Auth::logout ()

4.laravel debugging, you can use the DD () function, or you can use Laravel's own Log façade. For debugging questions, refer to this blog post for details https://segmentfault.com/n/1330000003808496

Common development tools and extensions for 5.laravel (declaration: Not necessarily I have used it as my collection)

jenssegers/agent--easily identify client information

stevenyangecho/laravel-u-editor--Baidu Editor

Overtrue/laravel-lang--laravel language packs from multiple countries

predis/predis--Best redis-php Expansion pack

teepluss/theme– Topics and resource management

eternicode/bootstrap-datepicker--Date selector designed for Bootstrap

anahkiasen/former--powerful Form builder independent of Laravel

6.laravel using BOWER+GULP integrated front-end resources, speak of the above many tools and expansion package, always say why to use, first Bower is a front-end package management tool, like installing Laravel Composer, if you are using Bower To introduce Bootstrap, you might see less files, less as I understand it is a precompiled language between CSS and JS that helps you to define HTML styles more quickly. Finally speaking Gulp, Gulp is a task management tool why don't we introduce these files directly and introduce them through Gulp? As I understand it, the introduction of GULP can help you improve efficiency in large projects!

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

and video from Geek College.

7.laravel paging function, the realization of Laravel page is very simple, I introduce here is based on eloquent model for paging, eloquent model Paginate method, This method automatically sets the appropriate offsets (offset) and limits (limit) based on the current User view page. By default, the current page is judged by the value of the HTTP request query string parameter? page. Of course, this value is automatically detected by Laravel and then automatically inserted into the link generated by the pager. After the Paginate function is called, you can invoke the render () method from the blade template in the view to achieve 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.