zaster
5 months ago
758
3
General

Many to Many - Retrieve multiple records through pivot table

Posted 5 months ago by zaster

Invoice and SubJob Models have a Many to Many Relationship

I want to do something like this

$assigned_jobs = $invoice->sub_jobs->where('visibility', 0)->get();

The above doesn't work

but the below works

$assigned_jobs = $invoice->sub_jobs->where('visibility', 0)->first();

How can i get multiple records

Please sign in or create an account to participate in this conversation.