Open ThomasPfuhl opened 6 years ago
Hi, Currently there's no support for generating enum types like that.
Thanx Kristijan for the info. So let me point out what I did:
Avoid commas in the fields argument:
php artisan make:form Forms/TestForm --fields="myfield:choices=>['coffee';'filter';'tea']"
The created code is then processed (regexps are fine for that) to generate
->add('myfield', 'select', [ 'choices' => ['0'=>'--','coffee','filter','tea']])
It's just an ugly workaround but it works.
I don't see a reason to add a choices option to a cli generator, since you can just go easily into the form class and add it there. It would be ok if it would be simple, but all these comma stuff makes it really complicated.
Hello, I want to generate a select box from a given enum list. Example:
php artisan make:form Forms/TestForm --fields="id:number,title:enum('coffee','tea','juice')"
I did not find a way to generate the desired piece of code from the commandline:
Any hints ? Thanks a lot !