deiucanta / laravel-smart

Automatic Migrations, Validation and More
48 stars 7 forks source link

Idea: timestamps() #4

Open robsontenorio opened 6 years ago

robsontenorio commented 6 years ago

Like original Laravel migration files. Something like this would be usefull:

<?php

namespace App;

use Deiucanta\Smart\Field;
use Deiucanta\Smart\Model;

class Product extends Model
{
    public function fields()
    {
        return [
            Field::make('id')->increments(),
            Field::make('titulo')->text(),
            Field::timestamps() // or some fancy method name
        ];
    }
}
deiucanta commented 6 years ago

I like this idea :) We need a special field type that can generate one or more fields behind the scenes.

The same issue is with rememberToken(). That is just a "type" but without name. Also, there is morphs() which generates two fields instead of one.

I'll put this on the roadmap! Thanks @robsontenorio