serverfireteam / panel

An easily configurable admin panel for Laravel applications.
MIT License
427 stars 144 forks source link

CRUD Fields Select Issue #335

Closed azizcelikeri closed 7 years ago

azizcelikeri commented 7 years ago

Hi,

I am trying to add my users model to panel. There is a user type field and it can be "A" or "B" and I want to use select box in CURD fields.

$this->edit->add('type', 'User Type', 'select')->insertValue(1)->options(["A" => "A", "B" => "B"]);

When I use code above the selected field is not getting from the database and it is A on page load. What is the problem?

hostingseguro commented 7 years ago

You can use: $this->edit->add('type', 'User Type', 'select')->option("A", "A",)->option("B", B");

But Im not sure why you're using insertValue(), this will insert 1 in your db directly.

Check this -> https://github.com/zofe/rapyd-laravel/wiki/Default-values

azizcelikeri commented 7 years ago

Thats my bad. Thank you very much :)