AventusModel Usage
In a Laraventus project, all models that are intended to be exposed to the frontend (via Aventus.js) or used inside Laraventus resources should extend:
Aventus\Laraventus\Models\AventusModelThis base class extends Laravel’s native Eloquent Model and adds behaviors and configurations specific to the Aventus ecosystem.
Example
Section titled “Example”<?php
namespace App\Models;
use Aventus\Laraventus\Models\AventusModel;
/** * @property string $name * @property string $email * @property string $password */class User extends AventusModel{ protected $fillable = [ 'name', 'email', 'password' ];}Configuration
Section titled “Configuration”You can configure the default behaviour of your model inside the file named config/laraventus.php.
<?php
return [ "model" => [ "timestamps" => true, "only_fillable" => true ]];- If you set the
timestampsto true, by default all your aventus models will have a timestamps. - If you set the
only_fillableto false, all data passed to the constructor will be defined inside the model. You can prevent some data to be added by overridingpreventKeys
protected function preventKeys(): array{ return ["\$type"];}