本文整理汇总了PHP中app\Customer::whereId方法的典型用法代码示例。如果您正苦于以下问题:PHP Customer::whereId方法的具体用法?PHP Customer::whereId怎么用?PHP Customer::whereId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Customer
的用法示例。
在下文中一共展示了Customer::whereId方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
public function update(Request $request, $id)
{
$customer = Customer::whereId($id)->first();
$customer->fill($request->all());
$customer->push();
return redirect('/customer/' . $id . '/show')->with('status', Alert::get('success', 'Informationen är uppdaterad.'));
}
示例2: update
public function update(Request $request, $id)
{
$customer = Customer::whereId($id)->firstOrFail();
$customer->customer = $request->get('customer');
$customer->street = $request->get('street');
$customer->city = $request->get('city');
$customer->state = $request->get('state');
$customer->zip = $request->get('zip');
$customer->save();
Toastr::success('Customer updated.');
return redirect(action('CustomersController@index', $customer->{$customer}));
}
示例3: show
public function show($id)
{
$order = Order::whereId($id)->firstOrFail();
$coffee1 = DB::table('coffees')->where('id', 2)->first();
$coffee2 = DB::table('coffees')->where('id', 3)->first();
$coffee3 = DB::table('coffees')->where('id', 4)->first();
$coffee4 = DB::table('coffees')->where('id', 5)->first();
$coffee5 = DB::table('coffees')->where('id', 6)->first();
$pastry1 = DB::table('pastries')->where('id', 7)->first();
$pastry2 = DB::table('pastries')->where('id', 10)->first();
$pastry3 = DB::table('pastries')->where('id', 11)->first();
$pastry4 = DB::table('pastries')->where('id', 12)->first();
$pastry5 = DB::table('pastries')->where('id', 15)->first();
$total = 0;
for ($i = 1; $i < 6; $i++) {
$total = ${'coffee' . $i}->price * $order->{'coffee' . $i} + ${'pastry' . $i}->price * $order->{'pastry' . $i} + $total;
}
$user = \Auth::user();
$customer = Customer::whereId($order->customerid)->firstOrFail();
return view('order.show', compact('order', 'coffee1', 'coffee2', 'coffee3', 'coffee4', 'coffee5', 'pastry1', 'pastry2', 'pastry3', 'pastry4', 'pastry5', 'total', 'user', 'customer'));
}
示例4: postCustomerEdit
public function postCustomerEdit(NewCustomerRequest $request, Customer $customer, CustomerProfile $profile, Payment $payment)
{
$id = $request->input('customer_id');
$this->customer = $customer->whereId((int) $id)->update(['firstname' => Str::title($request->input('firstname')), 'lastname' => Str::title($request->input('lastname')), 'email' => Str::lower($request->input('email')), 'phone' => $request->input('phone')]);
$dob = explode('/', $request->input('dob'));
$dob_piece = [$dob[2], $dob[1], $dob[0]];
$this->profile = $profile->where('customer_id', (int) $id)->update(['dob' => implode('-', $dob_piece), 'gender_id' => $request->input('gender'), 'state_id' => $request->input('state_of_origin'), 'hostel_address' => $request->input('hostel_address'), 'guardian_name' => Str::words($request->input('guardian_name')), 'guardian_phone' => $request->input('guardian_phone'), 'guardian_address' => $request->input('guardian_address')]);
$this->payment = $payment->where('customer_id', (int) $id)->update(['account_balance' => $request->input('account_balance')]);
if (!$this->customer && !$this->profile) {
flash()->error('An error occurred, try updating the Customer again!');
} else {
flash()->success('Customer Updated Successfully!');
}
return redirect()->route('customer.list');
}
示例5: getById
public function getById($id)
{
$customer = Customer::whereId($id)->with(['source', 'producers', 'samples' => function ($query) {
$query->orderBy('created_at', 'desc');
}, 'samples.assay_result'])->first();
return $customer;
}
示例6: remainPay
public function remainPay($id, SaleOrder $saleOrders, Request $request)
{
$customer = Customer::whereId($id)->first();
$saleOrder = SaleOrder::where('sales_orders.customer_id', $id)->where("sales_orders.balance", ">", 0)->get();
return view('saleOrders/remainPay', compact('saleOrder', 'customer'));
}
示例7: processPasteBuyerId
public function processPasteBuyerId(Request $request)
{
$data = $request->get('buyerIdList');
$fileContents = trim($data);
if (empty($fileContents)) {
return $this->json->error('Paste Box Must Not Be Empty ...');
}
$fileLines = explode("\r\n", $fileContents);
$fileLines = explode("\r", $fileContents);
$maxLineCount = count($fileLines);
$user = Auth::user();
for ($x = 0; $x < $maxLineCount; $x++) {
//dd( $fileLines[ $x ] );
$urlArray = parse_url($fileLines[$x]);
if (!is_array($urlArray) or !isset($urlArray['query'])) {
continue;
}
parse_str($urlArray['query'], $query);
$buyerId = $query['buyerID'];
$orderId = $query['orderID'];
/*$transaction = Transaction::where( 'amazon_order_id', '=', $orderId )
->with( ['customer.user' => function( $query ) use( $user ) {
$query->where( 'id', '=', $user->id );
}])->first();*/
$transaction = Transaction::where('amazon_order_id', '=', $orderId)->first();
if (!$transaction) {
continue;
}
$customer = Customer::whereId($transaction->customer_id)->first();
if (!$customer) {
continue;
}
if ($customer->user_id != $user->id) {
continue;
}
$customer->buyer_id = $buyerId;
$customer->save();
}
return $this->json->success('SUCCESS!!! Import data done ....');
}
示例8: Collection
});
$individualIds = array_diff($idArray, $range);
$customers = new Collection();
//fetch users
if (count($range)) {
foreach ($range as $fromTo) {
$rangeFromTo = array_map(function ($item) {
return trim($item);
}, preg_split('/-/', $fromTo));
$customers = $customers->merge(Customer::where('id', ">=", $rangeFromTo[0])->where('id', "<=", $rangeFromTo[1])->get());
}
}
if (count($individualIds)) {
foreach ($individualIds as $id) {
$id = trim($id);
$customers = $customers->merge(Customer::whereId($id)->get());
}
}
$variableMapping = ['/\\%CHI_NAME\\%/' => "chinese_name", '/\\%ENG_NAME\\%/' => "english_name", '/\\%TODAY\\%/' => "today", '/\\%LOGIN\\%/' => "loginname", '/\\%PASSWORD\\%/' => "password"];
$template = \App\Template::firstOrFail()->template;
$letters = [];
foreach ($customers as $user) {
$letter = $template;
foreach ($variableMapping as $pattern => $variable) {
if ($pattern == '/\\%TODAY\\%/') {
$today = \Carbon\Carbon::create()->toDateString();
$letter = preg_replace($pattern, $today, $letter);
} else {
$letter = preg_replace($pattern, $user->{$variable}, $letter);
}
}
示例9: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Customer $cus)
{
//
$data = $request->all();
unset($data['_token']);
unset($data['_method']);
$data['created_by'] = \Auth::user()->id;
$data['updated_by'] = \Auth::user()->id;
$data['is_active'] = 1;
$cus->whereId(Input::get('id'))->update($data);
return Redirect::route('customers.index');
}
示例10: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
$customer = Customer::whereId($id)->firstOrFail();
$customer->delete();
return redirect('/customers')->with('status', 'The selected customer has been deleted');
}