I'm relatively new with Laravel and I'm learning as well as working on Laravel based projects.
My question is what are Laravel Model/Eloquent Best Practices:
Is it better to pull records from the database this way Where I have only one function in my user Model like 'staff()':
$managers = $users->staff()->where('usertype', manager');
Or is better to pull records from the database this way Where I have multiple functions in my user Model like 'staff()', 'managers()', 'clerks()':
$managers = $users->managers();
$clerks = $users->clerks();
So basically, I'm asking if Such database related logic should be handled on Model end or Controller end?
PS: I'm on Laravel 5.5
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire