public function create(ApplicationRequest $request) { $services = Service::join('service_visas', 'services.id', '=', 'service_visas.service_id')->select('services.id', 'services.name', 'min_process', 'max_process')->orderBy('min_process')->orderBy('max_process')->where('country_id', '=', $request->get('country'))->groupBy('services.id')->get(); $service = $services->first(); $states = DB::table('states')->orderBy('name', 'asc')->lists('name', 'id'); $countries = Country::orderBy('name')->lists('name', 'id'); $country = Country::find($request->get('country')); return View('apply', ['services' => $services->lists('title', 'id'), 'service' => $service, 'country' => $country, 'countries' => $countries, 'states' => $states]); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function adminIndex() { $services = Service::join('countries', 'services.country_id', '=', 'countries.id')->select('services.id', 'services.name', 'min_process', 'max_process', 'countries.name as country', 'services.country_id')->orderBy('services.min_process')->get(); return View('admin.services', ['services' => $services, 'countries' => Country::all()]); }