Ejemplo n.º 1
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!session('city_id') || !session('city_name')) {
         $city = City::showCity();
         session(['city_name' => $city->name]);
         session(['city_id' => $city->id]);
     }
     return $next($request);
 }
Ejemplo n.º 2
0
 public function getChange(Request $request, $cityName)
 {
     $city = City::showCity($cityName);
     if ($city->name == $cityName) {
         session(['city_name' => $city->name]);
         session(['city_id' => $city->id]);
         $res = redirect()->back()->with('msgSuccess', '当前城市已切换至' . $city->name);
     } else {
         $res = redirect()->back()->withInput()->with('msgError', '该城市尚未开通');
     }
     return $res;
 }
Ejemplo n.º 3
0
 public function getAddresssave(Request $request, $id = 0)
 {
     $request->session()->reflash();
     $user = $request->user();
     $locations = $user->locationDetected();
     $citys = city::apiGet();
     $userCity = City::showCity($locations['city']);
     $TITLE = '添加地址';
     $address = '';
     if ($id) {
         $TITLE = '修改地址';
         $address = Address::apiFind($id);
     }
     return view('auth.account.addressave', ['TITLE' => $TITLE, 'META_KEYWORDS' => META_KEYWORDS, 'META_DESC' => META_DESC, 'PAGE_CODE' => 'auth.account.addressave', 'user' => $user, 'citys' => $citys, 'userCity' => $userCity, 'address' => $address, 'id' => $id]);
 }