Perhaps I am missing something; but when using
.. belongsTo('App\Org') or
$members = return $this->hasMany('App\Member'); models, I am finding that I often just return more than I need.
If an Org has Members;
If i want user data I have to do
Which gives me
If the user has any related fields, like contact numbers I am then working with
When returning public json output, i then have to clean up many of the fields being returned
(still learning how only return PARTS of the related models)
So with a query scope / custom mysql i could easily return a flat array of selected data for the memberDataOf($org)
What would you recommend?
Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.