Skip to content

Latest commit

 

History

History
34 lines (20 loc) · 1.65 KB

setup.md

File metadata and controls

34 lines (20 loc) · 1.65 KB

Setup

  1. Install the package via composer:

composer require --dev nova-horizons/realoquent

  1. Publish the config file:

php artisan vendor:publish --provider="NovaHorizons\Realoquent\RealoquentServiceProvider"

  1. Review config/realoquent.php and adjust as needed.

  2. Run php artisan realoquent:generate-schema to generate your initial schema file.
    This will examine your database schema and your Eloquent models to generate your starting schema.php. You may need to revise the detected column types to have more accurate casts/PHPDocs. Some common things you may want to adjust:

    • Change any UUID columns from ColumnType::string to ColumnType::uuid (same for ULIDs)
    • For JSON columns, they may be detected as ColumnType::longText or ColumnType::text
    • Review any ColumnType::tinyInt or ColumnType::boolean columns to make sure the detected type is correct

    See column types and generate-schema documentation for more details.

  3. Update your models with php realoquent:generate-models.
    This will create a new base model class, and update your existing models to extend it. The Base Model will have the fillable/guarded/casts and PHP Docs automatically generated. These should never be manually modified.
    All of your existing model logic will remain in the main model to keep your files clean and tidy.
    See Model docs and generate-models documentation for more details.

  4. Commit your schema.php and updated models

Head to Usage to learn how to use Realoquent.