I do request with joining tables:
$categories = Model::with("translate")->get();
In result object I get data with translate
for each row.
How can I exclude this from response?
I do request with joining tables:
$categories = Model::with("translate")->get();
In result object I get data with translate
for each row.
How can I exclude this from response?
with
is used for eager loading, not for joining tables.
Basically with eager loading you're initially fetching all your Models
and then making another query to get all the translate
instances related to your models. Then the translate models are added to your Models
To join the two tables you can do something like that:
$categories = Model::join('translate', 'model.id', '=', 'translate.model_id')->get();