Models
For ORM using Pandawa, we use Pandawa's AbstractModel instead of Laravel's Model.
Generating a new model
You could run php artisan pandawa:make:model to generate a base model.
tip
Read more about CLI.
Or, use the namespace at Pandawa\Component\Ddd\AbstractModel.
Template 📋
Replace the things encapsulated with <> including itself as well.
<?php
declare(strict_types=1);
namespace <Namespace>\<Folder>\Model;
use Pandawa\Component\Ddd\AbstractModel;
class <Name> extends AbstractModel {
//->
}
Key Differences
- You cannot delete or save an model directly without using a Repository.
- You don't need to set
$guardedor$fillableattributes manually.