Answer the question
In order to leave comments, you need to log in
How in Laravel to link a table with the last record of another by key?
goods are stored in one table. The rest is in another. each product corresponds to many rows of the remainder of another table. We need to get the goods and only the last record of the balance. I can't find the syntax.
public function rests() {
return $this->hasMany('App\Models\ProductRest', 'product_id', 'id');
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question