Пример #1
0
 /**
  * Displays a tabular list of registrations.
  */
 public function index()
 {
     $this->layout->with('subtitle', 'Registrations');
     $registrations = Registration::orderBy('registrations.created_at', 'desc')->join('bookings', 'registrations.booking_id', '=', 'bookings.id', 'left outer')->addSelect('registrations.*')->addSelect('bookings.first')->addSelect('bookings.last')->addSelect('bookings.email');
     $filtered = false;
     $filter_name = Session::get('registrations_filter_name', '');
     $filter_email = Session::get('registrations_filter_email', '');
     $filter_friday = Session::get('registrations_filter_friday', '');
     $filter_saturday = Session::get('registrations_filter_saturday', '');
     if (!empty($filter_name)) {
         $registrations = $registrations->where(function ($query) use($filter_name) {
             $query->where('bookings.first', 'LIKE', "%{$filter_name}%")->orWhere('bookings.last', 'LIKE', "%{$filter_name}%")->orWhere('registrations.name', 'LIKE', "%{$filter_name}%");
         });
         $filtered = true;
     }
     if (!empty($filter_email)) {
         $registrations = $registrations->where(function ($query) use($filter_email) {
             $query->where('bookings.email', 'LIKE', "%{$filter_email}%")->orWhere('registrations.email_address', 'LIKE', "%{$filter_email}%");
         });
         $filtered = true;
     }
     if (!empty($filter_friday)) {
         $registrations = $registrations->where(DB::raw('DAYOFWEEK(registrations.created_at)'), '=', 6);
         $filtered = true;
     }
     if (!empty($filter_saturday)) {
         $registrations = $registrations->where(DB::raw('DAYOFWEEK(registrations.created_at)'), '=', 7);
         $filtered = true;
     }
     $registrations = $registrations->paginate(25);
     $this->layout->content = View::make('registrations.index')->with('registrations', $registrations)->with('filtered', $filtered)->with('filter_name', $filter_name)->with('filter_email', $filter_email)->with('filter_friday', $filter_friday)->with('filter_saturday', $filter_saturday);
 }
Пример #2
0
 public function getRankedsub()
 {
     return var_dump(Registration::orderBy("rank", "ASC")->get()->toArray());
 }