I usually opt for this:
User::where('first_name', 'simon');
In fact you are wrong about Eloquent with
as it's not working dynamically like where
jarektkaczyk said:
In fact you are wrong about Eloquent
with
as it's not working dynamically likewhere
it does work differently, but still has that magic to it. with the eloquent where you can do crazier stuff (thanks to dynamicWhere() method) like this:
User::whereFirstNameAndId('simon', 1);
// same as
User::where('first_name', 'simon')->where('id', 1);
whereas in View you're limited to only one magic parameter.
View::make('base')->withSomeVar($val);
// same as
View::make('base')->with('someVar', $val);
Yes, of course you can do that.
For Eloquent Builder itself scopes
are working just the same. And there are more of this magic in L4
What I mean is, that it's Query Builder's feature (dynamic where
for queries), and View and RedirectResponse (dynamic with
on the View like in your example and return Redirect::to()->withInput()->withSomethingElse()
), while there's no dynamic with
for Eloquent (whereas with
loads relations).
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community