To facilitate development, the following packages should be installed
- barryvdh/laravel-ide-helper – this package will highlight code in your IDE.
- barryvdh/laravel-debugbar – a dashboard for debugging, which will deliver various query related information (for instance, sql queries that are made then opening this page)
- lanin/laravel-api-debugger – a package that helps to debug API, also helps to view sql queries.
- doctrine/dbal –needed to rune constructions in migrations that you will create.
Custom Laravel plugins developed by us:
- bwt-team/laravel-api – plugin to provide a single format for API response.
- bwt-team/laravel-error-mailer – plugin to end email notifications in case of errors.
Login and Registration
Simple login and registration are available out of the box.
Creation of Models
There is one out of box model in Laravel, User, which is stored in the app directory. Create Models directory in app directory, move model there and update namespace by adding ‘Models’ there. From now, all models will be stored in App\Models namespace. Please do not forget to update it in all places where User model has been used before (login, registration, settings etc).
After making a rough database design, you can create a model for every table. Better not to copy models but generate with the help of a special command. When model is generated, add the properties into it (‘table’, ‘fillable’, ‘visible’, ‘casts’, ‘dates’, ‘timestamps’) and all connections. If you have copied a previously existing model please make sure to get rid or update everything that you don’t need here including connected classes at file header, comments, phpdocs etc.
Creation of controllers
Controllers are not copied or created from scratch; controllers are created with the help of a console command. Please do not forget console command parameters, in order not create pre-set controllers for desired purposes (controller can be based on model).
For CRUD we recommend to use resource controllers, which are minimalistic and convenient. Other methods are written before resource controllers (see in documentation, why) and they always should obtain a name. Also, it might be useful to add comments to routings, which will help to visually find, which query will direct to a desired controller, and facilitate routing in general.
If you want to build a link, it should use a routing name. Thus, when you want to update a route, you only need to make changes in couple of lines of code, other than changing all urls in the application.