Answer the question
In order to leave comments, you need to log in
Laravel with how to use where on data from intermediate table?
There are 4 tables.
account_service (pivot table):
user_id (Belongs To Many)
service_id (Belongs To Many)
status
services:
id
tariff_id (One to One)
platform_id
(One to One)
platforms:
id
name
tariffs:
id
name
user:
$services = $this->with('services.tariff','services.platform')->first()->services;
$services[0]->pivot->status;
$services = $this->with('services.tariff','services.platform')->whereHas('services', function($q) {
$q->where('status', '=', 1);
})->first()->services;
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