Example #1
0
 public function homepage()
 {
     $user = Auth::user() ?: false;
     $cars = Car::with('inquiriesCount')->orderBy('domestic', 'asc')->orderBy('name')->get();
     $cars1 = $cars->filter(function ($item) {
         return $item->name == "ВАЗ";
     });
     $cars2 = $cars->filter(function ($item) {
         return $item->name != "ВАЗ";
     });
     $cars = $cars1->merge($cars2);
     $carsList = $cars->lists('name', 'id')->toArray();
     $lastInquiries = Inquiry::with('car', 'city')->orderBy('created_at', 'desc')->paginate(config('vars.inquiries_per_page'));
     $lastInquiries->setPath('inquiry/index');
     Carbon::setLocale(config('app.locale'));
     $lastNews = News::orderBy('published_at', 'desc')->paginate(config('vars.news_per_page'));
     $lastNews->setPath('news/index');
     $cities = City::lists('name', 'id')->all();
     $blocks = Block::all()->keyBy('alias');
     $faq = Faq::all();
     return view('homepage', compact('user', 'cars', 'carsList', 'lastInquiries', 'lastNews', 'cities', 'blocks', 'faq'));
 }
Example #2
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $items = Block::all();
     return view('admin.blocks.index', compact('items'));
 }
 public function printData($year, $month, $day, $room)
 {
     //$data = ReservationInfo::where('reservationDate',$date)->get();
     $date = $year . "-" . $month . "-" . $day;
     $blocks = Block::all();
     $data = ReservationInfo::where('reservationDate', $date)->where('room', $room)->get();
     $filas = "";
     foreach ($blocks as $block) {
         if (!$data->where('block_id', $block->id)->isEmpty()) {
             $info = $data->where('block_id', $block->id)->first();
             $filas .= "\n                <tr>\n                    <th>" . $block->startBlock . " a " . $block->finishBlock . "</th>\n                    <th>" . $info->Reservation->Patient->firstname . " " . $info->Reservation->Patient->lastname . "</th>\n                    <th>" . $info->Reservation->Atention->name . "</th>\n                    <th>" . $info->Reservation->Medic->name . "</th>\n                    <th class='" . $info->Reservation->status . "'>" . $info->Reservation->status . "</th>\n                </tr>";
         } else {
             $filas .= "\n                <tr>\n                    <th>" . $block->startBlock . " a " . $block->finishBlock . "</th>\n                    <th></th>\n                    <th></th>\n                    <th></th>\n                    <th></th>\n                </tr>";
         }
     }
     return $filas;
 }