samedi 18 juillet 2020

Populate dropdown with relation data in Laravel

I have a relation of category and sub category, I'm getting category data with related sub category using this query:

$data=Category::with('subcategory')->find($categoryID);

now i' getting category with related sub categories, that sub categories array i want to populate in the dropdown, Is there any way so that i can populate sub categories data without looping.

 


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire