Laravel 6 create subcategory for category and save it into database Laravel Bootstrap 4 (Part 6)

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

I don't mean to be disrespectful, but the subcategories should never be handled this way.
A subcategory is like a normal category, but with a parent_id (foreign key).
So you just need a migration to add a parent_id & update your create view with a select box.
Now you have a lot of duplicate code, which is hard to maintain.
DRY (don't reapeat yourself) is very important.
I appreciate that you make these video's though, so I hope you don't take it the wrong way.
Have a nice day!

tephrosisOfficial
visit shbcf.ru