atayahmet / laravel-nestable

Laravel 5 nested category/menu generator
MIT License
214 stars 52 forks source link

renderAsDropdown Getting white page #44

Closed kjareena closed 6 years ago

kjareena commented 6 years ago

Hi Atayahmet,

I Am using atayahmet/laravel-nestable plug.

As per document i installed your package everything is fine but i want my categories in drop down. For that i used like

                    EventCategory::attr(['name' => 'categories'])
                        ->selected(1)
                        ->renderAsDropdown(); 

in my view file its getting white page.

I am using laravel5.5 and php 7 versions

Please suggest me where i did mistake.

Thanks in advance.

kjareena commented 6 years ago

I have solved this issue.

This issue caused because i did not set parent_id as a for foreign key of main id.

Please suggest me how i set default " Select one " empty value in dropdown

josegus commented 5 years ago

Maybe you could return first as array, then use nestable() helpers with ->make()