A model is the interface between the API and your code. Each model has a set of default methods and optional model specific methods.
Clearly, this model can be used to retrieve information about grades. After creating a instance of the Magister class, a model can be used by first including the corresponding namespace:
use Magister\Models\Grade\Grade;
Since the Magister API utilizes surrogates, each model can be treated as a static class. For example, if one whishes to retrieve all grades, one can simply do:
$grades = Grade::all();
The first grade can be retrieved by doing:
$grade = Grade::first();
At some models, the user can specify parameters. This can be done with the where()
function. For example:
$grades = Grade::where('actievePerioden', 'false')->get();