Exemplo n.º 1
0
  public function getReceiverinfo (Request $request)
  {
    $user = Auth::user();

    $receiverInfoSet = ReceiverInfo::where('uid', '=', $user->id)

      ->where('active', '=', '1')

      ->orderBy('last_used', 'desc')

      ->orderBy('created_at', 'desc')

      ->get();

    $provinceSet = Province::all();      

    $provinces = array();

    foreach ($provinceSet as $province) {
    
      array_push($provinces, $province);
    
    }

    $cities = City::all();

    $districts = array();

    foreach ($cities as $city) {
    
      $district = District::where('city_code', '=', $city->code) 

        ->where('active', '=', '1')

        ->first();

      if ($district) {

        array_push($districts, $district);
    
      }

    }

    $receiverInfos = array();

    foreach ($receiverInfoSet as $receiverInfo) {
    
      array_push($receiverInfos, $receiverInfo);
    
    }

    $data = [
    
      'receiverInfos' => $receiverInfos,

      'provinces' => $provinces,

      'cities' => $cities,

      'districts' => $districts,

      'receiverActive' => true,

      'wTitle' => '个人中心 - 收货人信息'
    
    ];

    return view('profile/receiver_info', $data);
  
  }
Exemplo n.º 2
0
 public function getdistrict()
 {
     $equipmenttypes = District::where($this->state_id, Input::get('id'))->orderby('district', 'asc')->lists('district', 'id');
     $out = '<option value="">Select Option</option>';
     if ($equipmenttypes) {
         foreach ($equipmenttypes as $key => $equipmenttype) {
             $out .= '<option value="' . $key . '">' . $equipmenttype . '</option>';
         }
     }
     echo $out;
 }
Exemplo n.º 3
0
 /**
  * Get districts that belong to the city/province by city_id
  *
  * @param int $id City id
  *
  * @return \Illuminate\Support\Collection $collection
  */
 protected function _getDistrictsByCityId($id)
 {
     $dbRaw = DB::raw("id, CONCAT(type, ' ', name) as name");
     $districts = District::where('city_id', $id)->select($dbRaw)->orderBy('name')->get();
     return $districts;
 }
Exemplo n.º 4
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $data['project'] = $project = Project::find($id);
     if ($project) {
         $data['sectors'] = Sector::lists('name', 'id');
         $data['states'] = State::lists('state', 'id');
         $data['districts'] = District::where('state_id', $data['project']->state_id)->lists('district', 'id');
         $data['taluks'] = Taluk::where('district_id', $data['project']->district_id)->lists('taluk', 'id');
         $data['cancelbtn'] = Permission::hasPermission('projects.index');
         return view('projects.edit', $data);
     } else {
         Session::flash($this->danger, Lang::get('ruban.project.notfound'));
         return Redirect::route('ruban.projects.index');
     }
 }
Exemplo n.º 5
0
  public function getDistrict (Request $request) 
  {
    $city = $request->input('city'); 
  
    $districts = District::where('city_code', '=', $city)

      ->where('active', '=', 1)

      ->get();

    $html = $this->districtList($districts);

    return $this->successResponse('res', $html);
  
  }