reliese / laravel

Reliese Laravel Model Generator
MIT License
1.49k stars 316 forks source link

Feature request for Base File to make this package more Advanced #266

Open ShaikhDanish04 opened 1 year ago

ShaikhDanish04 commented 1 year ago

I believe having base files should not repeat the models but the base files should be used as the parent class for the Models

This will keep all the auto generated values in Base File abstract which can be re-generated to make sync

/Models/Base/Role.php

abstract class RoleBase extends Model {
    protected $table = 'db_roles';
    protected $primaryKey = 'role_id';
    public $timestamps = false;

    protected $casts = [
        'tenant_id' => 'int',
        'is_default' => 'bool'
    ];

    protected $fillable = [
        'tenant_id',
        'name',
        'description',
        'is_default',
        'permissions'
    ];
}

/Models/Role.php

class Role extends RoleBase {
        // Override if required
    protected $fillable = [
        'tenant_id',
        'name',
        'description',
        'is_default',
        'permissions'
    ];
}

I hope this is a very good feature to be implemented and will be very useful for bigger projects and make reliese a very good tool for long term in every project

👍