protected function findAddresses() { $this->newAddr = \App\Address::find($this->newId); $this->oldAddr = \App\Address::find($this->oldId); $this->result['addresses'] = 'found'; $this->checkStars(); }
/** * Display the specified resource. * * @param RentalAgreement $agreement * @return Response * @internal param int $id */ public function show(RentalAgreement $agreement) { $address = Address::find($agreement->property_id); $client = Client::find($agreement->client_id); $owner = Client::find($agreement->owner_id); return view('agreement.showAgreement', compact('agreement', 'address', 'client', 'owner')); }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { $addressId = $request->segments()[2]; $addrUser = Address::find($addressId); // if ($addrUser->user_id != Auth::user()->id) // { // return redirect('profile')->with('danger', 'This address is not associated with you.'); // } return $next($request); }
private function __construct($id) { $this->address = \App\Address::find($id); $this->stars = $this->address->stars()->get(); $this->findPlanets(); if ($this->centers = $this->address->centers()->count() > 0) { $this->centers = $this->address->centers()->get(); $this->findBaryPlanets(); } $this->findings = $this->address->discoveries()->get(); $this->terminate(); }
public function __construct(array $data) { parent::__construct($data); $this->address = \App\Address::find($data['address']); switch ($data['object']) { case 'star': $this->centerObject = \App\Star::find($data['objectId']); break; case 'multi': $this->centerObject = \App\Baricenter::find($data['objectId']); break; } }
public function postEdit(Request $request) { $this->validate($request, ['streetaddress' => 'required', 'city' => 'required', 'state_id' => 'required', 'zip' => 'required', 'phone' => 'required']); $address = \App\Address::find($request->id); $address->streetaddress = $request->streetaddress; $address->streetaddress2 = $request->streetaddress2; $address->city = $request->city; $address->state_id = $request->state_id; $address->zip = $request->zip; $address->phone = $request->phone; // $address->user_id = $request->user_id; $address->save(); \Session::flash('flash_message', 'Your address was updated.'); return redirect('/'); }
public function changeContactInfo(Request $request) { if ($request->type == 'contact') { $item = Contact::find($request->entity); if ($request->name == 'first_name') { $item->first_name = $request->value; } elseif ($request->name == 'last_name') { $item->last_name = $request->value; } elseif ($request->name == 'email') { $item->email = $request->value; } elseif ($request->name == 'title') { $item->title = $request->value; } else { } $item->save(); } elseif ($request->type == 'address') { $item = Address::find($request->entity); $item->full_string = $request->value; $item->save(); return $request->all(); } elseif ($request->type == 'phone') { $item = Phone::find($request->entity); if ($request->name == 'type') { $item->type = $request->value; } elseif ($request->name == 'number') { $item->number = $request->value; } elseif ($request->name == 'from') { $item->available_from = $request->value; } elseif ($request->name == 'to') { $item->available_to = $request->value; } else { } $item->save(); return $request->all(); } else { } }
public function changeData(Request $request) { $data = $request->except('_token'); $reg = \App\Region::where('name', $data['region'])->first(); if ($reg) { $addr = $reg->addresses()->where('name', $data['address'])->first(); if ($addr) { $oldId = $addr->id; if ($oldId != $data['adrId']) { \App\Myclasses\Uniter::unite($oldId, $data['adrId']); } return back(); } } else { $reg = new \App\Region(); $reg->name = $data['region']; $reg->save(); } $regId = $reg->id; $address = \App\Address::find($data['adrId']); $address->region_id = $regId; $address->name = $data['address']; $address->save(); $newData = new \App\Myclasses\Insides\Insider($address); $address->inside->data = serialize($newData); $address->inside->save(); return back(); }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update(Request $request, $id) { $v = \Validator::make($request->all(), $this->form_rules); if ($v->fails()) { return \Response::json(['success' => false, 'message' => trans('address.error_validation'), 'class' => 'alert alert-danger']); } $address = Address::find($id); $address->fill($request->all()); $address->save(); if ($address) { \Session::put('message', trans('address.success_update')); \Session::save(); return \Response::json(['success' => true, 'callback' => '/user/address']); } else { return \Response::json(['success' => false, 'message' => trans('address.error_updating'), 'class' => 'alert alert-danger']); } }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $address = Address::find($id); $property = Property::find($address->addressable_id); $property->delete(); $address->delete(); return redirect()->back(); }
public function __construct(array $data) { $this->data = $data; $this->address = \App\Address::find($data['address']); $this->checkExistence(); }
public function getUpdatePaymentAddressCustomer() { View::share(['navigator' => \NavigatorHelper::getNavigatorBarFE(), 'sideBar' => \NavigatorHelper::getSideBarFE()]); if (!Session::has('user')) { return redirect_errors('You login yet!'); } $user = Session::get('user'); if ($user['role_id'] != Role::CUS_ROLE_ID) { return redirect_errors('You are not Customer!'); } $customer = new Customer(); $cusInfo = $customer->with('user')->where('user_id', $user['id'])->first()->toArray(); $current_City = Address::find($cusInfo['city_id'])->id; $cities = Address::where('parent_id', 0)->get()->toArray(); $state = Address::find($cusInfo['state_id'])->toArray(); return view('change_payment_address.index')->with(['info' => $cusInfo, 'currentCity' => $current_City, 'cities' => $cities, 'state' => $state]); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $address = Address::find($id); Activity::log('Deleted an address.'); $address->delete(); return Redirect::action('AddressController@index')->with('status', 'Address information was successfully updated.'); }
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { if (!Address::find($id)) { // return view('dashboard.supplierProfileEdit'); return redirect()->back()->withErrors(['messages' => "adres bulunamadı"]); } $address = Address::find($id); if (Auth::user()->id != $address->customer_id) { //return view('dashboard.supplierProfileEdit'); return redirect()->back()->withErrors(['messages' => "adres size ait değil"]); } $addressRules = array('address_name' => 'required', 'name' => 'required', 'surname' => 'required', 'phone_number' => 'required|digits:11', 'city' => 'required', 'country' => 'required', 'distinct' => 'required', 'zip_code' => 'required', 'address_detail' => 'required'); // do the validation ---------------------------------- // validate against the inputs from our form $validator = Validator::make($request->all(), $addressRules); // check if the validator failed ----------------------- if ($validator->fails()) { // get the error messages from the validator $updateProduct = $validator->messages(); // redirect our user back to the form with the errors from the validator // return view('dashboard.supplierProfileEdit'); return back()->withInput()->withErrors($validator); } else { $user = Auth::user(); $address->customer_id = $user->id; $address->address_name = $request->input('address_name'); $address->name = $request->input('name'); $address->surname = $request->input('surname'); $address->phone_number = $request->input('phone_number'); $address->distinct = $request->input('distinct'); $address->city = $request->input('city'); $address->country = $request->input('country'); $address->address_detail = $request->input('address_detail'); $address->zip_code = $request->input('zip_code'); $address->update(); return redirect()->back()->with('success', ['Adres bilgileriniz güncellendi']); } }
/** * function to action to rate both the order and its content * @param $order_id int * @return */ public function rateOrder($order_id) { //Checks if the user is logged in $user = \Auth::user(); if ($user) { //Finds the order to be rated and checks if it belongs to the current user $order = Order::where('id', $order_id)->where('user_id', $user->id)->first(); // dd($order->details); if ($order) { $address = Address::find($order->address_id); $seller = User::find($order->seller_id); $business = Business::where('user_id', $order->seller_id)->first(); // $jsonOrder = json_encode($order->toArray()); // $jsonOrderAddress = json_encode($address->toArray()); // $jsonBusiness = json_encode($business->toArray()); return view('orders.rate_order', compact('order', 'seller', 'business')); // return view('orders.rate_order', compact('order', 'seller', 'business', 'jsonOrder', 'jsonOrderAddress', 'jsonBusiness')); } else { return redirect('/user/orders'); } } else { return redirect('/'); } }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $data = $request->all(); $validator = $this->validator($data); if ($validator->fails()) { return response(['errors' => $validator->messages()], 400); } // create appointment address (identical to the user's address but NOT the same) $oldAddress = Address::find($data['address_id']); $newAddress = new Address(); $address = $newAddress->create(array_except($oldAddress->toArray(), ['id'])); $data = array_except($data, ['address_id']); $data['end_user_id'] = Auth::user()->userable->id; // store $appointment = new Appointment(); $newAppointment = $appointment->create($data); // Insert related address $newAppointment->address()->associate($address); // Reward user for online appointment $points = Config::get('services.points.online_appointment'); Auth::user()->userable->addPoints($points, 'Online appointment'); $newAppointment['points_rewarded'] = $points; return response($newAppointment->load('address')->load('mastori'), 201); }
public function __construct(array $data) { parent::__construct($data); $this->address = \App\Address::find($data['address']); $this->checkStar(); }
public function viewOrder($id) { $order = $this->with('status')->with('deliveryDetailOfGuest')->with('deliveryDetailOfCustomer', 'deliveryDetailOfCustomer.user')->with('OrderDetail', 'OrderDetail.product', 'OrderDetail.product.priceGroup')->find($id)->toArray(); $listAttrFromDelivery = ['email', 'first_name', 'last_name', 'address1', 'address2', 'city_id', 'state_id']; $row = []; // dd($order); $row['customer_info'] = []; foreach ($order as $k => $property) { if (is_array($property) && !empty($property)) { if (strcmp($this::DELIVERY_DETAIL_CUSTOMER, $k) == 0) { foreach ($property as $keyDDPP => $DeliveryDetailPP) { if (strcmp($keyDDPP, $this::CUSTOMER) == 0) { $row['customer_info']['phone'] = $DeliveryDetailPP['phone']; $row['customer_info']['email'] = $DeliveryDetailPP['email']; } else { if (in_array($keyDDPP, $listAttrFromDelivery)) { $row['customer_info'][$keyDDPP] = $DeliveryDetailPP; } } } } elseif (strcmp($this::DELIVERY_DETAIL_GUEST, $k) == 0) { foreach ($property as $keyDDPP => $DeliveryDetailPP) { $row['customer_info'][$keyDDPP] = $DeliveryDetailPP; } } if (strcmp($k, $this::ORDER_DETAIL) == 0) { $row['order'] = []; $row['order']['total'] = 0; $row['order']['item'] = 0; foreach ($property as $keyOD => $OrderDetail) { $row['order']['detail'][] = $OrderDetail; $subTotal = $OrderDetail['quantity'] * $OrderDetail['price']; $row['order']['total'] += $subTotal; $row['order']['item'] += $OrderDetail['quantity']; } } if ($k == 'status') { $row[$k] = $property['name']; } } else { $row[$k] = $property; } } $row['customer_info']['city_id'] = Address::find($row['customer_info']['city_id'])->name; $row['customer_info']['state_id'] = Address::find($row['customer_info']['state_id'])->name; return $row; }
public function update($id, AddressRequest $request) { Address::find($id)->update($request->all()); }