laravel / ideas

Issues board used for Laravel internals discussions.
940 stars 28 forks source link

Add n flag for Laravel Nova in artisan #1323

Open dillingham opened 6 years ago

dillingham commented 6 years ago

Adding the -n flag for php artisan make:model Post -n -m -f would be wonderful

And have it make the nova Post resource behind the scenes

fletch3555 commented 6 years ago

I don't think this should be included as not everyone will have nova available.

fletch3555 commented 6 years ago

What do you envision the flag would do? Generate a nova resource? Will it know how if Nova isn't installed? I imagined it would call artisan nova:resource, which would fail if it's not installed.

So yes, it does hurt to have it there. It would appear as broken functionality. Yeah, you could catch that error and display a "Nova not installed" message instead. I just feel like that's crossing responsibilities too much. Let the framework do it's thing, and just take the 2 seconds to run the nova:resource command manually right after generating the model. -m generates a migration, but it's blank so you have to go populate that after as well.

I guess I don't see the benefit of it being in the framework.

drbyte commented 6 years ago

Can Nova's artisan commands override/extend the core Laravel artisan commands in a way that adds the -n or other additions to the core commands?

dillingham commented 6 years ago

@drbyte ah thats a good idea! Maybe it extends it and adds the flag

Would make it nova's responsibility & would only change make:model if nova is installed

Found an article that describes it: Extending Laravel’s migration command to add new options