Closed tabacitu closed 7 years ago
My 2 cents: I understand and see the posibilities of having this name schema (for example for the numeric fields), and that would do a +1 to the feature
BUT I really think we have a MVC issue here, those names are great for database schemas, but not really enought for daily "presentation" of form fields, for example maybe you use a varchar text for storing an IP address, but a "addField" varchar for that would need a lot of custom attributes for it to validate. Same goes for an image cropper, that in the end is just a text field, but needs a lot of frontend customization.
So support for a setFromMigration
would be nice as an adition, but I think the long term is having a lot of custom components; not a component per attribute of course, read-only, etc, but image croppers, master-detail views, markdown/wysiwyg editors, etc...
Please excuse my bad english :disappointed:
What @MarcosBL said. Those names are great for databases as those are the column types. But i think for the "addField" we should use what is closer to HTML's "input" types.
Thanks for the input, guys, you make a good point. Let's keep them in mind when we make new fields, but renaming them to fit this pattern... let's drop that like it's hot.
Cheers!
Priority: low low low
I think a very intuitive way to name the field and column type would have been using the column names used in Laravel migrations.
We need to keep the names we have now for backwards-compatibility, of course, but we could create these new fields, too, as aliases of existing fields.
PROs:
setFromMigration()
method (alongsidesetFromDb()
) or to have the fields and columns written one-by-one; generating CRUDs from migrations should be simpler than from DB, because there's only one migration type;CONs:
What do you guys think? Pasting the table with all the names below so it's easier.
$table->bigIncrements('id');
$table->bigInteger('votes');
$table->binary('data');
$table->boolean('confirmed');
$table->char('name', 4);
$table->date('created_at');
$table->dateTime('created_at');
$table->dateTimeTz('created_at');
$table->decimal('amount', 5, 2);
$table->double('column', 15, 8);
$table->enum('choices', ['foo', 'bar']);
$table->float('amount', 8, 2);
$table->increments('id');
$table->integer('votes');
$table->ipAddress('visitor');
$table->json('options');
$table->jsonb('options');
$table->longText('description');
$table->macAddress('device');
$table->mediumIncrements('id');
$table->mediumInteger('numbers');
$table->mediumText('description');
$table->morphs('taggable');
taggable_id
and STRINGtaggable_type
.$table->nullableMorphs('taggable');
morphs()
columns.$table->nullableTimestamps();
timestamps()
columns.$table->rememberToken();
remember_token
as VARCHAR(100) NULL.$table->smallIncrements('id');
$table->smallInteger('votes');
$table->softDeletes();
deleted_at
column for soft deletes.$table->string('email');
$table->string('name', 100);
$table->text('description');
$table->time('sunrise');
$table->timeTz('sunrise');
$table->tinyInteger('numbers');
$table->timestamp('added_on');
$table->timestampTz('added_on');
$table->timestamps();
created_at
andupdated_at
columns.$table->timestampsTz();
created_at
andupdated_at
(with timezone) columns.$table->unsignedBigInteger('votes');
$table->unsignedInteger('votes');
$table->unsignedMediumInteger('votes');
$table->unsignedSmallInteger('votes');
$table->unsignedTinyInteger('votes');
$table->uuid('id');