Answer the question
In order to leave comments, you need to log in
How to properly build Laravel relationships?
There are 3 tables
products [ id, name, model_id]
models[id, name, brand_id]
brands[id, name]
I make a type select:
Where is model - $this->belongsTo(Model::class)
How can I link the table with the brand now? Product::take(10)->with('model', 'brand')->get();
Answer the question
In order to leave comments, you need to log in
Product::take(10)->with('model', 'model.brand')->get();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question