Model View Controller

Laravel is built upon MVC, by default Laravel uses Eloquent for the model business layer which uses the Active Record Pattern. In Projects2, Doctrine is used as a drop in replacement instead, this is possible with the Laravel Doctrine package.

All models are located in namespace App\Entities All controllers are located in namespace App\Http\Controllers All views are located in the directory resources/views

Explicit Model Binding

In the majority of the application, models are injected in to the controllers by looking at the routes. The route may have an ID which is specified in the routes/web.php file, this is then resolved for the controller to use without having to manually fetch the entity every time.

The logic to fetch this is defined explicitly, new entities will need adding to the definition in: App\Providers\RouteServiceProvider

Service Classes

All application logic should be kept within the many service classes to reduce code duplication and make the code base more maintainable. Services are located in App\Services


Doctrine by default uses repositories, all entities have a repository, even if they don't have any exclusive functionality. All entity respositories are sub classes of the App\Repositories\EntityRepository which extends the base Doctrine repository class.

Blade Templates and Theme

All of the primary pages inherit the functionality and styling from the main theme template. The template is located in resources/views/theme/master.blade.php

PDF and Mailables

PDFs are generated usking Webkit Html to PDF (WKHTMLTOPDF).