コード例 #1
0
 public function delAddress()
 {
     $obj = new helpers();
     if (!$obj->checkMemberLogin()) {
         return redirect('memberLogin');
     }
     $id = Request::input('id');
     if (empty($id)) {
         return redirect('member-shipping-address');
     }
     $address = Address::find($id);
     try {
         if ($address->delete()) {
             Session::flash('success', 'Shipping Address successfully deleted.');
             return redirect('member-shipping-address');
         } else {
             Session::flash('error', 'Unable to delete record.');
             return redirect('member-shipping-address');
         }
     } catch (PDOException $e) {
     }
 }
コード例 #2
0
ファイル: BrandController.php プロジェクト: amittier5/miramix
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $brand = Brandmember::find($id);
     $brand->password = '';
     //$brand->slug='';
     $baddress = Address::find($brand->address);
     $country = DB::table('countries')->orderBy('name', 'ASC')->get();
     $alldata = array();
     foreach ($country as $key => $value) {
         $alldata[$value->country_id] = $value->name;
     }
     $states = DB::table('zones')->where('country_id', $baddress->country_id)->orderBy('name', 'ASC')->get();
     $allstates = array();
     foreach ($states as $key => $value) {
         $allstates[$value->zone_id] = $value->name;
     }
     return view('admin.brands.edit', compact('brand', 'baddress', 'alldata', 'allstates'), array('title' => 'Edit Brand', 'module_head' => 'Edit Brand'));
 }
コード例 #3
0
ファイル: BrandController.php プロジェクト: ujjaluipl/miramix
 public function delAddress()
 {
     $obj = new helpers();
     if (!$obj->checkBrandLogin()) {
         return redirect('brandLogin');
     }
     $id = Request::input('id');
     if (empty($id)) {
         return redirect('brand-shipping-address');
     }
     $address = Address::find($id);
     $address->delete();
     Session::flash('success', 'Shipping Address successfully deleted.');
     return redirect('brand-shipping-address');
 }
コード例 #4
0
 public function addAddress()
 {
     if (Input::has('addressID')) {
         $rules = ['description_modal' => 'required', 'address_modal' => 'required', 'city_modal' => 'required', 'country_modal' => 'required', 'zip_modal' => 'required', 'phone_modal' => 'required', 'email_modal' => 'required|email'];
     } else {
         $rules = ['description' => 'required', 'address' => 'required', 'city' => 'required', 'country' => 'required', 'zip' => 'required', 'phone' => 'required', 'email' => 'required|email'];
     }
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Response::json(['result' => 'failed', 'error' => $validator->getMessageBag()->toArray()]);
     } else {
         if (Input::has('addressID')) {
             $addressID = Input::get('addressID');
             $address = AddressModel::find($addressID);
             $peopleId = Input::get('peopleID');
             $address->peopleId = Input::get('peopleID');
             $address->addressDesc = Input::get('description_modal');
             $address->address = Input::get('address_modal');
             $address->addressLine2 = Input::get('address2_modal');
             $address->city = Input::get('city_modal');
             $address->state = Input::get('state_modal');
             $address->zip = Input::get('zip_modal');
             $address->province = Input::get('province_modal');
             $address->country = Input::get('country_modal');
             $address->phone = Input::get('phone_modal');
             $address->email = Input::get('email_modal');
             $address->save();
         } else {
             $address = new AddressModel();
             $peopleId = Input::get('peopleID');
             $address->peopleId = Input::get('peopleID');
             $address->addressDesc = Input::get('description');
             $address->address = Input::get('address');
             $address->addressLine2 = Input::get('address2');
             $address->city = Input::get('city');
             $address->state = Input::get('state');
             $address->zip = Input::get('zip');
             $address->province = Input::get('province');
             $address->country = Input::get('country');
             $address->phone = Input::get('phone');
             $address->email = Input::get('email');
             $address->save();
         }
         $addressList = AddressModel::whereRaw('peopleId=?', array($peopleId))->get();
         $countList = count($addressList);
         $list = "";
         for ($i = 0; $i < count($addressList); $i++) {
             if ($i % 2 == 0) {
                 $list .= "<div class='row'>";
             }
             $list .= '<div class="col-md-6">
                             <div class="panel panel-blue margin-bottom-40">
                                 <div class="panel-heading">
                                     <h3 class="panel-title">';
             $list .= $addressList[$i]->addressDesc;
             $list .= '<a herf="javascript:void(0)" onclick="onEdit(' . $addressList[$i]->id . ')" style="cursor: pointer"> [ Edit ] </a>
                                     </h3>
                                 </div>
                                 <div class="panel-body">
                                     <div class="margin-bottom-40" >
                                         <div class="form-group">
                                             <p>' . $addressList[$i]->address . " " . $addressList[$i]->addressLine2 . '</p>
                                         </div>
                                         <div class="form-group">
                                             <p>' . $addressList[$i]->city . ', ';
             if ($addressList[$i]->state != "") {
                 $list .= $addressList[$i]->state;
                 if ($addressList[$i]->province != "") {
                     $list .= "(" . $addressList[$i]->province . "), " . $addressList[$i]->zip;
                 } else {
                     $list .= ", " . $addressList[$i]->zip;
                 }
             } else {
                 if ($addressList[$i]->province != "") {
                     $list .= "(" . $addressList[$i]->province . "), " . $addressList[$i]->zip;
                 } else {
                     $list .= " " . $addressList[$i]->zip;
                 }
             }
             $list .= '</p>
                                          </div>
                                         <div class="form-group">
                                             <p>' . $addressList[$i]->country . '</p>
                                         </div>
                                         <div class="form-group">
                                             <p>' . $addressList[$i]->phone . ' - ' . $addressList[$i]->email . '</p>
                                         </div>
                                     </div>
                                 </div>
                             </div>
                         </div>';
             $countList = $countList - 1;
             if ($i % 2 == 1 || $countList == 0) {
                 $list .= '</div>';
             }
         }
         $countList = count($addressList);
         return Response::json(['result' => 'success', 'list' => $list, 'countAddress' => $countList, 'message' => "Address saved successfully."]);
     }
 }