Optimized (sub-)booking methods and index view for eager loading.
This commit is contained in:
@@ -16,9 +16,10 @@ class BookingsController extends Controller
|
||||
*/
|
||||
public function index($year)
|
||||
{
|
||||
$bookings = Booking::whereYear('date', '=', $year)
|
||||
$bookings = Booking::with('subBookings.accountType.accountClass.ioType',
|
||||
'subBookings.project')
|
||||
->whereYear('date', '=', $year)
|
||||
->orderBy('date')
|
||||
->withCount('subBookings')
|
||||
->get()
|
||||
->groupBy(function($item) {
|
||||
return Carbon::parse($item->date)->format('n');
|
||||
|
||||
Reference in New Issue
Block a user