Skip to content

Conversation

@sfinktah
Copy link

I am not worthy, and this is not quality code,

However I despise having to manually add the $fillable and $casts properties into my Models, when I have this lovely tool that already knows all my column names.

So this:

artisan make:migration:schema create_test2_table \
    --schema="product_id:integer,tag:string,vcdb_group_id:timestamp" \
    --model=Test2

Will now generate this:

// ...
class Test2 extends Model
{
    use HasFactory;

    protected $fillable = ['product_id', 'tag', 'vcdb_group_id'];

    protected $casts = [
        'vcdb_group_id' => 'datetime',
    ];
}

I have an automated Nova::Resource generator too, but I'll look to see how this is received and if there are suggestion for more eloquent code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant