Eloquent - with - Limiting the amount of loaded fields
Eloquent - with - Limiting the amount of fields loaded in relations
Eloquent - toBase - Prevent Model loading, reducing memory usage
Eloquent - Speed up retrieving data from related models
Eloquent - Search with multiple terms over multiple models
Eloquent - whereHas - Only query if the relation exists with some condition
Eloquent - addSelect - Add an attribute on a model based on a related models attribute
Eloquent - whereDate - Several data related where examples
Eloquent - increment - Incrementing values
Eloquent - replicate - Replicate a model
You can cache all select queries in a request, so no double queries get executed. To acomplisch this you can add the App\Traits\CacheQueryBuilderTrait
trait to your model. This will overrule the newBaseQueryBuilder
of the model with it's own builder (App\Database\CacheQueryBuilder
).
Now all select queries get cached for one second within the scope of the request.
App\Services\QueryMonitorService
provides logic to register and log a lot of performance related details about all the queries done to the database.
App\Facades\QueryMonitorFacade
is the Facade class of the App\Services\QueryMonitorService
.
Add the following method to App\Http\Kernel
:
public function terminate($request, $response)
{
// Write all the remembered queries to the info log before the request exits.
\App\Facades\QueryMonitorFacade::logResults();
parent::terminate($request, $response);
}
Put the following in the App\Providers\AppServiceProvider::register()
:
// Registers the query listener
\App\Facades\QueryMonitorFacade::injectListener();
Put the following in the App\Providers\AppServiceProvider::boot()
:
// Start listening for queries
\App\Facades\QueryMonitorFacade::startListening();
App\Nova\Actions\FlowAction contains an example using the epartment/nova-dependency-container package to create some sort of flow in an Action form modal.
Introduction to Package Development
Debug bar Adds a debug bar that provides you with debug information of the request.
Shift Blueprint Blueprint is an open-source tool for rapidly generating multiple Laravel components from a single, human-readable definition.
Medialibrary This package can associate all sorts of files with Eloquent models. It provides a simple API to work with.
Permissions This package allows you to manage user permissions and roles in a database.
Package skeleton A package skeleton Spatie uses for there packages.
Translatable This package contains a trait to make Eloquent models translatable. Translations are stored as json. There is no extra table needed to hold them.
Excel Supercharged Excel exports and imports in Laravel.
Scribe Generate API documentation for humans from your Laravel codebase.
ER diagram generator This package lets you generate entity relation diagrams by inspecting the relationships defined in your model files.
Nova - Settings This Laravel Nova package allows you to create custom settings in code (using Nova's native fields) and creates a UI for the users where the settings can be edited.
Laravel Packer Laravel Packer is a command line tool for speeding up your package creation.
Nova - Tiptap Editor Field A WYSIWYG editor that's probably better then Trix.
Nova - Collapsible Resource Manager
Nova - Resource Navigation Tab
Nova - translatable This package contains a Translatable class you can use to make any Nova field type translatable.
Nova - tags field This package contains a Nova field to add tags to resources.
Nova - package skeleton This repo contains a skeleton to easily create Nova Tool packages.
When ending your migration name with to_[table], Laravel automatically adds the Schema call into the new migration file.
The command php artisan make:migration foo_bar_to_users
will results in:
Schema::table('users', function (Blueprint $table) {
//
});