1 / 4

Advice and Best Practices For Laravel Development

The major thing loved about Laravel would be the way it is built. As a Laravel Development Company, we use our expertise to empower your business. Read more: https://bit.ly/2QJOVl4

Download Presentation

Advice and Best Practices For Laravel Development

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Advice and Best Practices For Laravel Development The major thing loved about ​Laravel would be the way it is built, Yes! It is built with the help of best practices that are used in programming that is available in the current times. My personal preference would always be to always stick to Laravel’s recommended Code Base structure. This can even be done in various alternative ways but can lead into some issues furthermore. Using the Migrations

  2. One should prefer migrations for their website instead of making a manual database. Compiling is Preferable One must always use Gulp, Elixer for compiling the scripts and sass into minified version for better performance, Laravel did the basic housekeeping for you. Use Artisan One must prefer Artisan CLI rather than creating stuff manually in order to fasten up the productivity. Routes One must not write closures into the routes file, rather, move them to controller. Try one must not overpopulate the routes file, rather make groups for user roles and resources. Naming Convention When using the naming convention to create custom classes and functions with the models, you must be careful. Laravel works on the principle in which for a table named users, it would expect the model name to be user, make sure you are not playing with it. Segregate Code Try to make the Repository patterns for your business logic instead of writing in the controllers. Make Services and Events for specific functionality. ​E.g. Event : Order Placed. Service : Email Try to make the helper functions for your redundant code and reuse them.

  3. Make sure you do not forget using CSRF tokens, as Laravel provides the security through CSRF. Use .env files to store any secure information and retrieve it via getenv function. These should be no instance on which you will put it inside models/controllers and commit it to Git. Blade Templating In views files, ​Laravel provides blade templating, So make use of it to get template instead of writing php code (). Database Stuffs Make use of Eloquent ORM for database stuff. It’s very easy to make rather than using a sql query. Laravel provides relationship through the model itself. So that querying the data will be easier than the raw queries. DON’T insert fake values directly into the database for testing purposes. Create Seeder files and faker to populate your database.     Visit Our Social Profile    ​

  4. Contact Us Company Name​: Elsner Technologies Pvt Ltd Address​: 305,306 Iscon Center, Shivranjani Cross Road, Satellite, Ahmedabad, India. Email Address​: ​sales@elsner.com Website​: ​https://www.elsner.com/

More Related