예제 #1
0
 public function bySchool()
 {
     return School::join('subscriptions', 'schools.name', '=', 'subscriptions.school')->where('subscriptions.ignored', false)->select('schools.*', DB::raw('(select count(*) from subscriptions where subscriptions.ignored = false and schools.name = subscriptions.school) as subscriptionCount'))->get();
 }
예제 #2
0
 function schools()
 {
     $schools = School::join('subscriptions', 'subscriptions.school', '=', 'schools.name')->select(['schools.name', 'schools.city', DB::raw('count(*) as schoolcount')])->groupBy(['schools.name', 'schools.city'])->orderBy('schoolcount', 'desc')->orderBy('schools.city')->orderBy('schools.name')->get();
     return view('admin.schools')->with('schools', $schools);
 }