vendredi 2 décembre 2016

newQuery() in Laravel

Whats the difference between doing:

$model = User::newQuery();
$model->published(1);
$model->get();

And:

$model = new User;
$model = $model->published(1);
$model = $model->get();

I know with the second example you have to assign the call back to the model. But is there any difference to these?

Note, I'm not chaining as there would be some conditions between checking if it should be published or not etc.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2ggkZeW
via IFTTT

Aucun commentaire:

Enregistrer un commentaire