select for the ENUM field from database
I try to make select for the database ENUM field $table->enum('priority', ['низкий', 'средний', 'высокий'])->default('низкий');, but none of the example fields from ExampleFieldsScreen class can't do the job.
I tried these option
Select::make('task.priority')
->title('Приоритет задачи'),
Input::make('task.priority')
->title('Приоритет задачи')
->datalist(['низкий', 'средний', 'высокий'])
->horizontal(),
Relation::make('task')
->fromModel(Task::class, 'priority')
->title('Select for Eloquent model'),
Sorry. I forget to $task->priority = $request->input('task.priority'); in create method, so in general this code works
Input::make('task.priority')
->title('Приоритет задачи')
->datalist(['низкий', 'средний', 'высокий'])
->horizontal(),
But maybe there is a way not to indicate datalist and get them from database directly to avoid mistype?
@schel4ok use php enums to store possible options or, alternatively, you can try to adapt it to your needs https://stackoverflow.com/questions/2350052/how-can-i-get-enum-possible-values-in-a-mysql-database
But in think php enums better