laravel-idea / plugin

Laravel Idea plugin for PhpStorm
https://laravel-idea.com/
161 stars 7 forks source link

"New Eloquent Model" UI discussion #741

Open adelf opened 1 year ago

adelf commented 1 year ago

Planned features:

logic-b-o-m-b commented 1 year ago

I would like to see:

I really like changes in recent version. Thank you!

DevRaeph commented 1 year ago

i would love to see:

silas229 commented 1 year ago

Please add "$fillable" checkbox next to nullable which is automatically checked

Antons-S commented 1 year ago

Maybe if you check 'Create factory' then model should have HasFactory trait

use Illuminate\Database\Eloquent\Factories\HasFactory;

class ModelName extends Model
{
    use HasFactory
adelf commented 1 year ago

@Antons-S totally forgot. Fixed. Thank you!

Kriso1337 commented 1 year ago

it would be great to see there editable length for string, also decimal type for MySql is also great feature, with editable "total" and "places" fields

sneycampos commented 1 year ago

Since we can create Models in non default namespace, e.g: Modules\Buildings\Models, would be interesting if the Factory was created on same namespace (Modules\Buildings\Factories) and uses the newFactory() method on Model to assign the factory correctly, since it is not on default namespace Database\Factories.

raveren commented 1 year ago

Great, but it's not using the overriden stubs :/ image

benounnas commented 1 year ago

when it comes to foreign keys and the suggestions above, i didn't see the mention of the option cascadeOnDelete & cascadeOnUpdate, Events & Observers, may be a trait attaching area too ?

osbre commented 1 year ago

Ideas:

bokoch commented 1 year ago

Would be great to have an option to generate php-doc with model attributes.

mwaqar666 commented 1 year ago

It would be nice to have $table property also. It would be optional (which is the default behavior). But you can add a custom table name in $table property to associate the model to the provided table name.

Thank you for the great plugin ❤️

henryavila commented 1 year ago

This plugin is wonderfull!!

It would be nice to to add the phpdoc @property for every db column on model created.

sneycampos commented 1 year ago

Hmm, i don't think so. The plugin itself does this work to avoid these annotations on code...

7met commented 1 year ago

I like to use ULIDs (or UUID) as primary keys, it would be nice to se that as an option, or an overall config for a given site with the HasULIDs or HasUUIDs trait auto added to the model.

Overall though this is really great and love what you've done. Well worth the money.

JackWH commented 1 year ago

This is a great addition, thank you! The only thing I'd love to see is auto-generated TypeScript type definitions for our models... 😎😍

A checkbox in this new UI would be great, but it'd be an awesome utility elsewhere in the plugin too. Cheers!

himak commented 1 year ago

Please add functions as remove field or setting order fields with moving up and down.

n1xn commented 1 year ago

Polymorphic checkbox would be nice

mcxzyang commented 1 year ago

Please add decimal to the type list and add comment to the field.

cornelRaiu commented 1 year ago

An option for generating Pivot models would be nice too.

php artisan make:model Member --pivot

verkit commented 1 year ago

It would be nice if added button to remove field

PatrickJoannisse commented 1 year ago

Just want to second @raveren's point that not leveraging overridden stubs.

A good example of this is multitenancy and having overridden stubs to make sure the tenant id is added to every model, factory and migration moving forward. This way removing the field becomes a conscious decision rather than an oversight.

davidseverwright commented 12 months ago

It would be nice if there was support for enum's too. Ideally when enum is selected it would have a list of all backed enums to select from, and then automatically pull the values into the migration and add the cast to the model.

Being able to create a new enum as part of creating the model would be extra-nice.

adelf commented 12 months ago

Just want to second @raveren's point that not leveraging overridden stubs. A good example of this is multitenancy and having overridden stubs to make sure the tenant id is added to every model, factory and migration moving forward. This way removing the field becomes a conscious decision rather than an oversight.

You(and every package creator for their packages) will be able to add an option to the right part(id, timestamps). If it checked - some fields will be added to migration, some traits to the model... and so on.

adelf commented 12 months ago

@davidseverwright good idea. Thanks. I'll try.

raveren commented 12 months ago

@adelf there's much more power in the custom stubs and Laravel did not make them customizeable for no reason.

For example I use them to support our HUGE systems historically, unfortunately, custom-named created_at columns and some other stuff. I had to extend Blueprints inbuilt class for that.

argolian commented 11 months ago

Wonderful plugin which I use a lot. Like others would like to see additional fields for String Sizes. Add Foreign and ForeignIDs, Enum With Options Field (Not 100% sure about this one since there's debate whether we should use enums and the practibility of adding a field list).

Finn-Amperative commented 11 months ago

Would love to be able to reorder fields once I've filled them in, and the ability to choose the date type instead of just datetime would be useful. Also the ability to access the rest of the project while the modal is open would be nice, as I often need to refer back to the code while creating a new model to check the relationships.

bmckay959 commented 11 months ago

Great plugin!

I deal with a bunch of 3rd party data where the table structure is essentially already done. A lot of these have a bunch of columns(50+ sometimes).

FoksVHox commented 10 months ago

It would be nice to see the following things:

silas229 commented 10 months ago

I am not the maintainer or even a contributor to the project, but I think it should be clear to everyone that it is impossible to integrate the entire Eloquent Framework into a single window. Therefore, we have to focus on core elements that are annoying to write by hand. Many features mentioned here are certainly practical, but impossible to implement in their entirety.

FoksVHox commented 10 months ago

I am not the maintainer or even a contributor to the project, but I think it should be clear to everyone that it is impossible to integrate the entire Eloquent Framework into a single window. Therefore, we have to focus on core elements that are annoying to write by hand. Many features mentioned here are certainly practical, but impossible to implement in their entirety.

@silas229 The field types isn't impossible, and so are many of the suggestions.

silas229 commented 10 months ago

@silas229 The field types isn't impossible, and so are many of the suggestions.

Of course, it is possible to implement them, but if you want to implement all Eloquent features, the software is no longer usable

FoksVHox commented 10 months ago

@silas229 The field types isn't impossible, and so are many of the suggestions.

Of course, it is possible to implement them, but if you want to implement all Eloquent features, the software is no longer usable

I'd disagree, as long as it's designed properly.

JurgenThijs commented 9 months ago

I always use the $guarded = ['id'] instead of the $fillable array

balanso commented 8 months ago

when i add boolean field in "New eloquent model" i want to see 'boolean' validator in Form request, but i don't see it.

lloricode commented 8 months ago

Hi please add search on selecting type, it just convenient if does, thank you

Heyian commented 7 months ago

I just want to second the need for customised stubs, it would be great to use this plugin with the custom stubs.

Bark-fa commented 6 months ago

It would be great if we could specify default values when creating models

Phelms215 commented 6 months ago

After seeing the new form, what would be really amazing is a blueprint/visio style linker to create relationships

Muetze42 commented 6 months ago

add $fillable array to model class doesn't work with version 8.0.2.231 in my case.

The option add $casts array to model class would be a usefull option.

adelf commented 6 months ago

@Muetze42 ID and updated/created fields aren't included in "fillable", so it seems it is empty in your case. Laravel Idea generates the "casts" property if it needs to cast some fields.

Wimmie commented 5 months ago

Please add functions as remove field or setting order fields with moving up and down.

If you leave a field empty, it will not be generated.

MYHINDA commented 5 months ago

I am not the maintainer or even a contributor to the project, but I think it should be clear to everyone that it is impossible to integrate the entire Eloquent Framework into a single window. Therefore, we have to focus on core elements that are annoying to write by hand. Many features mentioned here are certainly practical, but impossible to implement in their entirety.

@silas229 The field types isn't impossible, and so are many of the suggestions.

right. setting order fields would be helpful. option to customize path of controllers - if i want to save some controllers in a specific sub directory (Such API) option to change table name with all references.

thank you

ricocrivelli commented 4 months ago

It would be nice to see the following things:

* The `date` column type, currently it's just the `dateTime` column type.

* The ability to change the table name.

* The ability to limit the length on fields, like `string("my_field", 4)`.

* The ability to mark a field `unique`.

* The ability to add comments on columns.

I'm missing the date column type too!

sneycampos commented 4 months ago

It would be nice to see the following things:

* The `date` column type, currently it's just the `dateTime` column type.

* The ability to change the table name.

* The ability to limit the length on fields, like `string("my_field", 4)`.

* The ability to mark a field `unique`.

* The ability to add comments on columns.

I'm missing the date column type too!

What version are you using? i see "date" column image

ricocrivelli commented 4 months ago

It would be nice to see the following things:

* The `date` column type, currently it's just the `dateTime` column type.

* The ability to change the table name.

* The ability to limit the length on fields, like `string("my_field", 4)`.

* The ability to mark a field `unique`.

* The ability to add comments on columns.

I'm missing the date column type too!

What version are you using? i see "date" column image

Oh! My bad! I was using an old version! Thanks very much @sneycampos ! Brazilians saving brazilians! =)

arm092 commented 4 months ago

Nice to have:

Thank You!

altayevrim commented 2 months ago

default value should be great for boolean fields for example (or for every field) because when I create a model with API and test it, omitting boolean fields throws an SQL error.

Also when I use Jetstream, I have to uncheck Register in Auth Service Provider option in Policy Settings otherwise it gives an error (Register Policy Error - There is no Auth Service Provider classes in the project) but the policy works perfectly fine (probably thanks to Policy Discovery)

Thanks for this great plugin by the way. It works great!

caendesilva commented 2 months ago

Just discovered this UI today, it's amazing!

I think a small dictionary for common PascalCase names could be added.

For example I have model called App\Models\GitHubRepository, but the UI suggests git_hub_repository_id when it should be github_repository_id

Adding common names like GitHub could a small but nice improvement.

I'm also missing an option to create a (Pest) test?