avored / laravel-ecommerce

AvoRed an Open Source Laravel Shopping Cart
https://avored.com
1.51k stars 549 forks source link

Category disappears from view after create/update #89

Closed darron1217 closed 7 years ago

darron1217 commented 7 years ago

While parent_id on categories table is nullable integer,

https://github.com/mage2/laravel-ecommerce/blob/dc333623244b587d5b61e3609d5e66210ec98070/modules/mage2/ecommerce/database/migrations/2017_03_29_000000_mage2_ecommerce_schema.php#L159

Category::getAllCategories() function check empty parent_id with 0.

https://github.com/mage2/laravel-ecommerce/blob/dc333623244b587d5b61e3609d5e66210ec98070/modules/mage2/ecommerce/src/Models/Database/Category.php#L67

So whenever we add/modify category with no parent, category disappears from view. https://github.com/mage2/laravel-ecommerce/blob/dc333623244b587d5b61e3609d5e66210ec98070/modules/mage2/ecommerce/src/Http/ViewComposers/LayoutAppComposer.php#L45

indpurvesh commented 7 years ago

This bug should be fixed. Yes in Past it was not null and default to 0 but now i changed to Null