Пример #1
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $monthes = array(1 => 'Января', 2 => 'Февраля', 3 => 'Марта', 4 => 'Апреля', 5 => 'Мая', 6 => 'Июня', 7 => 'Июля', 8 => 'Августа', 9 => 'Сентября', 10 => 'Октября', 11 => 'Ноября', 12 => 'Декабря');
     $programs = Program::join('vacations', 'programs.id', '=', 'vacations.program_id')->where('programs.active', '=', '1')->where('vacations.active', '=', 1)->select('programs.*', 'vacations.*', 'vacations.id as vacation_id', 'programs.id as id')->get();
     $all_news = News::where('active', '=', '1')->get();
     if (Auth::check()) {
         $user = Auth::user()->name;
     } else {
         $user = '******';
     }
     return view('index', ['programs' => $programs, 'monthes' => $monthes, 'all_news' => $all_news, 'user' => $user]);
 }