Check scopes on this link: http://laravel.com/docs/eloquent#query-scopes
This way you can query your database and select only projects which are visible to user
Currently I'm building my view this way:
@foreach($customers as $customer)
<tr class="ignore-from-filtering">
<td colspan="6"><strong> {{ $customer->name }}</strong> ({{ $customer->projects->count() }})</td>
</tr>
@foreach($customer->projects as $project)
/* ... */
So, where to implement the scopes?
You will probably want to check out: http://laravel.com/docs/eloquent#eager-loading ("Eager Load Constraints")
and/or
Are there any examples out there for scopes? I can't figure out, how they really work :/
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community