K
K
Konstantin B.2019-09-09 07:26:56
Laravel
Konstantin B., 2019-09-09 07:26:56

How in Laravel to prevent the receipt of a relation if they were not requested in the controller?

We all know that Laravel can get relationship data by property, even if we did not receive this data in the request.
$model->relationName
Is it possible to disable this very magic for the model / all models and make it so that if there was no request from the controller through with, then when there was no request through the property?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
JhaoDa, 2019-09-09
@JhaoDa

A strange desire, of course. You can try to override the method in the model, changing the behavior to the desired one.
And then catching heisenbugs...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question