Models

Representation of your Database tables.

In your console/terminal/cmd/poweshell/gitbash or other console tool go to your project directory and type:

$ php BoosterCLI make: model user

Remember Booster works with conventions all models must have a singular filename, even if you type it in plural, BoosterCLI change it to singular, if you want to use Booster ORM this is imperative and only models have this property.

Now you could go to:

app/Models/user.php

You will find the next code:

<?php
namespace App\Models;
use Libs\BoosterORM\Modelo;
class User extends Modelo
{
    protected static $table = 'users';
}
?>

Now you could see a static property table:

As a convention to work with BoosterORM you CAN NOT change the plural for table name.

You could create one model for every table, but it does not mean that you are obligate to use models, if you want to use MVC thats the best way to fit everything automatically.

Instead of MVC if some table is not going to be use so much or you does not want to use MVC, Booster provide a BoosterQueryBuilder Library to create fluent querys without the creation of models.

Feel free to use Models in certain tables or queryBuilder its totally free to you.

Last updated