I have three tables call Users, Services, Categories and pivot table call professionals. Also four models for all tables.
User: Id, name Services: id, service_name Categories: id, service_id, category_name Professionals: id, user_id, service_id, category_id
Relationships User has many Categories Service has many categories category can have one service category belongs to many users
$result = Professional::where('user_id’,’=‘,54)->get();
Above command give data like this, { "id": 1, "user_id": 54, "service_id": 8, "category_id": 20 }, { "id": 2, "user_id": 54, "service_id": 10, "category_id": 23 }, { "id": 3, "user_id": 54, "service_id": 9, "category_id": 21 }, { "id": 4, "user_id": 54, "service_id": 10, "category_id": 22 }
Please help me to get data from Professionals table with categories and services details related to a user, guide me how to make relations on models
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2MIKJ7y
via IFTTT
Aucun commentaire:
Enregistrer un commentaire