Introduction
Retrieving Models
Once you have created a matrix, you are ready to start receiving data from your database. Behind the scenes, Fusion will generate and connect a dedicated Eloquent model class for your matrix to its generated database table. Because of this, querying matrix entries and pages is handled natively by Eloquent.
Resolving Model Instances
Because the Eloquent model associated with matrices is generated on the fly, you will need to resolve the model instance through the Builder
. Just pass through the handle
of the matrix you'd like to resolve:
$model = new \App\Services\Builders\Collection('flights');
Once retrieved, you will have a fresh Eloquent model instance ready to be queried:
$flights = $model->where('active', 1)
->orderBy('name', 'desc')
->take(10)
->get();