public function index(Model $objects) { $infoConfig = InfoConfig::first()->toArray(); if ($infoConfig['vacancies']) { return view('info.vacancies', ['objects' => $objects->orderBy('created_at', 'desc')->paginate(6), 'type' => 'vacancies', 'title' => LANG . '_title', 'description' => LANG . '_description', 'text' => LANG . '_text', 'requirements' => LANG . '_requirements', 'contacts' => LANG . '_contacts', 'infoConfig' => $infoConfig]); } else { unset($infoConfig['vacancies']); foreach ($infoConfig as $key => $item) { if ($item) { return redirect(LANG . '/' . $key); } } return redirect(LANG); } }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $vacancies = Vacancy::orderBy('created_at', 'asc')->get(); return view('vacancies/index', ['vacancies' => $vacancies]); }