当前位置: 首页>>代码示例>>PHP>>正文


PHP Customer::find方法代码示例

本文整理汇总了PHP中app\Customer::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Customer::find方法的具体用法?PHP Customer::find怎么用?PHP Customer::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\Customer的用法示例。


在下文中一共展示了Customer::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: showGroup

 public function showGroup()
 {
     $customer_id = Auth::user()->customer->id;
     $group = User::with('unpaidOrders')->where('customer_id', $customer_id)->get();
     $spendings = Customer::find($customer_id)->unpaidOrders->sum('total_price');
     return view('account.group', compact('group', 'spendings'));
 }
开发者ID:jhruby23,项目名称:barapp,代码行数:7,代码来源:AccountController.php

示例2: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index($id)
 {
     $customer = Customer::find($id);
     $titles = Title::where('customer_id', Auth::user()->id)->orderBy('created_at', 'desc')->get();
     $allUsers = $this->getAllUsers($customer);
     return view("titles.index", compact('titles', 'allUsers', 'customer'));
 }
开发者ID:sasafister,项目名称:scheduler,代码行数:12,代码来源:CustomersController.php

示例3: saveCustomer

 public function saveCustomer(Request $request)
 {
     if ($request->customer_id != "") {
         $customer = Customer::find($request->customer_id);
         $customer->name = $request->name;
         $customer->phone = $request->phone;
         $customer->address = $request->address;
         User::where('userable_id', '=', $request->customer_id)->update(['email' => $request->email, 'banned' => $request->banned]);
         $check = $customer->save();
         if ($check) {
             return "EDIT_SUCCEED";
         } else {
             return "Có lỗi xảy ra. Vui lòng thử lại sau!";
         }
     } else {
         $customer = new Customer();
         $customer->name = $request->name;
         $customer->phone = $request->phone;
         $customer->address = $request->address;
         $check = $customer->save();
         if ($check) {
             $data = array('msg' => 'ADD_SUCCEED', 'customer_id' => $customer->id);
             return $data;
         } else {
             return "Có lỗi xảy ra. Vui lòng thử lại sau!";
         }
     }
 }
开发者ID:phucanhhoang,项目名称:IT4895,代码行数:28,代码来源:CustomerController.php

示例4: authorize

 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     $id = $this->route('id');
     if ($id == 0) {
         return TRUE;
     }
     return \Auth::user()->owns(\App\Customer::find($id));
 }
开发者ID:aljogabot,项目名称:AmazonStats,代码行数:13,代码来源:CustomerSaveRequest.php

示例5: orders

 public function orders()
 {
     $orders = Order::all();
     foreach ($orders as $order) {
         $customer = Customer::find($order->customer_id);
         echo "Ordered by: " . $order->customer->name . "<br />";
         echo $order->name . "<p />";
     }
 }
开发者ID:Craig115,项目名称:dev,代码行数:9,代码来源:OrderController.php

示例6: show

 public function show($id)
 {
     $customer = Customer::find($id);
     echo "my name is: " . $customer->name . "<br />";
     $orders = $customer->orders;
     foreach ($orders as $order) {
         echo $order->name . "<br />";
     }
 }
开发者ID:Craig115,项目名称:dev,代码行数:9,代码来源:CustomerController.php

示例7: show

 public function show($id)
 {
     echo 'hit';
     $customer = Customer::find($id);
     echo 'Hello my name is ' . $customer->name . '<br/>';
     $orders = $customer->orders;
     foreach ($orders as $order) {
         echo $order->name . "<br/>";
     }
 }
开发者ID:Robin-Wang-0331,项目名称:hua,代码行数:10,代码来源:CustomerController.php

示例8: getCustomer

 public static function getCustomer($session_token)
 {
     $session = MobileSession::where('session_id', $session_token)->first();
     if ($session) {
         $customer_id = $session->user_id;
         $customer = Customer::find($customer_id);
         return $customer;
     }
     throw new Exception("Invalid Session Token", 1);
 }
开发者ID:vampirethura,项目名称:modelvillage,代码行数:10,代码来源:SessionUtil.php

示例9: update

 function update(Request $request, $id)
 {
     if ($id) {
         $allInput = $request->all();
         $customer = Customer::find($id);
         $customer->update($allInput);
         Session::flash('flash_message', 'Customer updated successfully.');
         Session::flash('flash_type', 'alert-success');
     }
     return redirect('order?c=' . $id);
 }
开发者ID:ramant15,项目名称:ektimo,代码行数:11,代码来源:CustomersController.php

示例10: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $message = Session::get('message');
     $customer_id = Session::get('customer');
     if (isset($customer_id)) {
         $customer = Customer::find($customer_id);
     }
     $q = QuoteRequest::find($id);
     $quote_request = $q;
     return view('quote_requests.edit', compact('q', 'quote_request', 'message', 'customer_id', 'customer'));
 }
开发者ID:AlexAustralia,项目名称:printflow,代码行数:17,代码来源:QuoteRequestsController.php

示例11: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store($customerId)
 {
     $customer = \App\Customer::find($customerId);
     $amount = \Input::get('amount');
     $payment = new \App\CustomerPayment();
     $amount = (int) str_replace(['.', ','], ['', ''], $amount);
     $amount *= 100;
     $payment->amount = $amount;
     $customer->payments()->save($payment);
     return redirect()->route('customers.show', [$customerId]);
 }
开发者ID:bengitiger,项目名称:cleverup-crm-laravel5,代码行数:16,代码来源:PaymentsController.php

示例12: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $user = User::find(1);
     $customer = Customer::find(1);
     $contact = Contact::find(1);
     $prod = Product::find(1);
     $iol_prod = Product::find(2);
     $briefing_owner = BriefingOwner::find(1);
     $briefing_source = BriefingSource::find(1);
     factory(App\Briefing::class)->create(['user_id' => $user->id, 'last_updated_user_id' => $user->id, 'customer_id' => $customer->id, 'customer_type_id' => $customer->customer_type_id, 'contact_id' => $contact->id, 'prod_id' => $prod->id, 'iol_prod_id' => $iol_prod->id, 'briefing_owner_id' => $briefing_owner->id, 'briefing_source_id' => $briefing_source->id]);
 }
开发者ID:programadorjff,项目名称:ioltest,代码行数:16,代码来源:BriefingsTableSeeder.php

示例13: save

 public function save($id, SaveTransactionRequest $request)
 {
     $transaction = $this->transactionRepository->getById($id);
     if ($transaction && Gate::denies('save', $transaction)) {
         return $this->json->error('You cannot alter other\'s Transactions ...');
     }
     if (!$transaction) {
         $transaction = new \App\Transaction();
     }
     $transaction->fill($request->except(['customer_id']));
     \App\Customer::find($request->get('customer_id'))->transactions()->save($transaction);
     return $this->json->success();
 }
开发者ID:aljogabot,项目名称:AmazonStats,代码行数:13,代码来源:TransactionsController.php

示例14: boot

 /**
  * Register any application authentication / authorization services.
  *
  * @param  \Illuminate\Contracts\Auth\Access\Gate  $gate
  * @return void
  */
 public function boot(GateContract $gate)
 {
     $this->registerPolicies($gate);
     // role: super admin, manager, super agent, agent
     // page: dashboard, properties(villa, villa rental, land), enquiry, customer, blog, page, setting
     $gate->define('property-edit', function ($user, $property_id) {
         $user = $user->get();
         $property = \App\Property::find($property_id);
         if ($user->role_id == 3 or $user->role_id == 4) {
             return $property->user_id == $user->id;
         }
         if ($user->role_id == 2) {
             return $property->user->branch_id == $user->branch_id;
         }
         if ($user->role_id == 1) {
             return true;
         }
     });
     $gate->define('enquiry-edit', function ($user, $enquiry_id) {
         $user = $user->get();
         $enquiry = \App\Enquiry::find($enquiry_id);
         if ($user->role_id == 3 or $user->role_id == 4) {
             return $enquiry->property->user_id == $user->id;
         }
         if ($user->role_id == 2) {
             return $enquiry->property->user->branch_id == $user->branch_id;
         }
         if ($user->role_id == 1) {
             return true;
         }
     });
     $gate->define('customer-edit', function ($user, $customer_id) {
         $user = $user->get();
         $customer = \App\Customer::find($customer_id);
         // if ($user->role_id == 3 OR $user->role_id == 4) return $customer->user_id == $user->id;
         // if ($user->role_id == 2) return $customer->user->branch_id == $user->branch_id;
         if ($user->role_id == 1) {
             return true;
         }
     });
     $gate->define('user-edit', function ($user, $user_id) {
         $user = $user->get();
         $account = \App\User::find($user_id);
         if ($user->role_id == 2) {
             return $account->branch_id == $user->branch_id;
         }
         if ($user->role_id == 1) {
             return true;
         }
     });
 }
开发者ID:borislemke,项目名称:kbr,代码行数:57,代码来源:AuthServiceProvider.php

示例15: pay

 public function pay(Request $request)
 {
     $token = $request['token'];
     $cutomer_id = $request['customer_id'];
     $total_price = $request['total'] * 100;
     $customer = Customer::find($cutomer_id);
     if ($customer->charge($total_price, ['source' => $token, 'receipt_email' => $customer->email])) {
         $mess = ['status' => "OK", "message" => "Payment ok"];
         return $mess;
     } else {
         $mess = ['status' => "ERROR", "message" => "Error submitting payment"];
         return $mess;
     }
 }
开发者ID:elasbandis,项目名称:ProjectBooking,代码行数:14,代码来源:PaymentController.php


注:本文中的app\Customer::find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。