本文整理汇总了PHP中app\Address::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Address::find方法的具体用法?PHP Address::find怎么用?PHP Address::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Address
的用法示例。
在下文中一共展示了Address::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: findAddresses
protected function findAddresses()
{
$this->newAddr = \App\Address::find($this->newId);
$this->oldAddr = \App\Address::find($this->oldId);
$this->result['addresses'] = 'found';
$this->checkStars();
}
示例2: show
/**
* 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'));
}
示例3: handle
/**
* 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);
}
示例4: __construct
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();
}
示例5: __construct
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;
}
}
示例6: postEdit
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('/');
}
示例7: changeContactInfo
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 {
}
}
示例8: changeData
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();
}
示例9: update
/**
* 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']);
}
}
示例10: destroy
/**
* 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();
}
示例11: __construct
public function __construct(array $data)
{
$this->data = $data;
$this->address = \App\Address::find($data['address']);
$this->checkExistence();
}
示例12: getUpdatePaymentAddressCustomer
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]);
}
示例13: destroy
/**
* 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.');
}
示例14: update
/**
* 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']);
}
}
示例15: rateOrder
/**
* 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('/');
}
}