Eloquent

Full support for Eloquent models and migrations is included if that's your preferred way of managing the database. This page will explain everything you need to know about using Eloquent within Apex.

Creating Models

You can create a new Eloquent model exactly the same way as creating an Apex model using the opus model CLI command with the only difference being you add the --eloquent flag. For example:

apex opus model MyPackage/Models/DemoTable --dbtable demo_table --eloquent

This will create a new Eloquent model at /src/MyPackage/Models/DemoTable.php that works exactly the same as the Eloquent models you are used to.

Creating Migrations

You may create a new Eloquent migration by simply adding the --eloquent flag to the standard migration create CLI command. For example:

apex migration create my-package new-feature --eloquent

This will create a new migration within the /etc/MyPackage/Migrations/Eloquent/ directory which uses Blueprint.