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


PHP Customer::find方法代码示例

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


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

示例1: actionUser

 public function actionUser()
 {
     //Customer::deleteAll();
     if (isset($_POST['searchV'])) {
         $searchq = $_POST['searchV'];
         $query = CustomerSocialLogin::findBySql('select * from customer')->all();
         /*for($x=1;$x<6;$x++)
         		 {
         		 $customer = Customer::get($x);
         		 var_dump($customer->customer_user_name);
         		} */
         /*	$count=1;
          		  foreach($query as $q)
          		 {
          		 $customer = new Customer();
          		 $customer->primaryKey = $count;
          		 $customer->attributes = ['customer_user_name' => $q->customer_user_name, 'customer_first_name' => $q->customer_first_name,'customer_last_name' => $q->customer_last_name];
          		 $customer->save();
          		 $count++;
          		} */
         //$result = Customer::find()->query(["match" => ["customer_user_name" => $searchq]])->asArray()->all();
         $result = Customer::find()->query(["fuzzy_like_this" => ["fields" => ["customer_user_name"], "like_text" => $searchq, "max_query_terms" => 25]])->asArray()->all();
         //var_dump($result);
         for ($x = 0; $x < count($result); $x++) {
             $val = $result[$x];
             $res = $val['_source'];
             $res = $res['customer_user_name'];
             echo '<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;<a>' . $res . '</a></div>';
         }
     } else {
         echo '<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;no results for the search</div>';
     }
 }
开发者ID:nishanthpininti,项目名称:nishanth-work-nudostilo,代码行数:33,代码来源:DefaultController.php

示例2: deleteIndex

 public function deleteIndex()
 {
     $id = Input::get('id');
     $customer = Customer::find($id);
     $customer->delete();
     return $id;
 }
开发者ID:berzeek,项目名称:realdash,代码行数:7,代码来源:ClientController.php

示例3: getCustomer

 public function getCustomer($id)
 {
     $customer = Customer::find($id);
     if ($customer == null) {
         return Error::make("No Customer Found");
     } else {
         return Error::success("Customer found", $customer->toArray());
     }
 }
开发者ID:prateekchandan,项目名称:dipatchtaxicab-server,代码行数:9,代码来源:APIController.php

示例4: getAppointments

 public function getAppointments()
 {
     $appointments = Appointment::all();
     $calendarAppointments = array();
     foreach ($appointments as $a) {
         $customer = Customer::find($a['customer_id']);
         $customer = $customer->first_name . ' ' . $customer->last_name;
         $event = array('title' => 'Appointment with ' . $customer, 'start' => $a['appointment_datetime']);
         array_push($calendarAppointments, $event);
     }
     return View::make('admin/appointments')->with('appointments', $calendarAppointments);
 }
开发者ID:RetinaInc,项目名称:booking-app,代码行数:12,代码来源:AdminController.php

示例5: update

 public function update()
 {
     $inputs = Input::all();
     $customer = Customer::find($inputs['pk']);
     $customer->{$inputs}['name'] = $inputs['value'];
     //tt($customer->save());
     if ($customer->save()) {
         $data['status'] = 'success';
     } else {
         $data['status'] = 'danger';
     }
     return Response::json($data);
 }
开发者ID:sliekasirdis79,项目名称:POS,代码行数:13,代码来源:AdminCustomerController.php

示例6: delete

 /**
  * 
  * @param type $_id
  * @return \Illuminate\Http\Response Description
  */
 public function delete($_id)
 {
     $customer = Customer::find($_id);
     $response = array('status' => false, '_id' => $_id);
     $contracts = $customer->contracts();
     if ($customer->delete()) {
         foreach ($contracts as $contract) {
             $contract->delete();
         }
         $response['status'] = true;
     }
     $headers = array('Content-type' => 'application/json');
     return \Illuminate\Http\Response::create($response, 200, $headers);
 }
开发者ID:ma7euus,项目名称:test,代码行数:19,代码来源:CustomerController.php

示例7: update

 public function update($id)
 {
     // Validation
     $input = Input::all();
     try {
         $validate_data = $this->_validator->validate($input);
     } catch (ValidationException $e) {
         return Redirect::back()->withInput()->withErrors($e->get_errors());
     }
     $customer = Customer::find($id);
     if (!$customer->update($input)) {
         return Redirect::back()->with('error', 'Error while trying to update Customer')->withInput();
     }
     return Redirect::route('show_customer_path', array($customer['id']))->with('success', 'Customer updated.');
 }
开发者ID:UniquelySimilar,项目名称:order_mgmt_laravel,代码行数:15,代码来源:CustomerController.php

示例8: profile

 /**
  * Display the customer's profile page after successful login.
  */
 public function profile(Customer $customer = NULL)
 {
     if (is_null($customer)) {
         if (Auth::check()) {
             //echo Auth::user()->email;
             $customer = Customer::find(Auth::id());
             $orders = Order::where('customer_id', '=', Auth::id())->get();
             $this->layout->content = View::make('customers.profile', compact('customer', 'orders'));
         } else {
             return Redirect::to('login');
         }
     } else {
         $orders = Order::where('customer_id', '=', $customer->id)->get();
         $this->layout->content = View::make('customers.profile', compact('customer', 'orders'));
     }
 }
开发者ID:marciocamello,项目名称:laravel-ecommerce,代码行数:19,代码来源:CustomersController.php

示例9: indexAction

 public function indexAction()
 {
     if (!$this->request->isPost()) {
         Tag::setDefault('email', ' ');
         Tag::setDefault('password', '');
     } else {
         $name = trim($this->request->getPost('name', array('string', 'striptags')));
         $password = trim($this->request->getPost('password'));
         $password = sha1($password);
         $detail = Customer::find("name = " . $name);
         if ($password == sha1($detail->num)) {
             return $this->forward("search/jump");
         } else {
             $this->flash->error("错误");
         }
     }
 }
开发者ID:lookingatsky,项目名称:zhonghewanbang,代码行数:17,代码来源:SearchController.php

示例10: login

 public function login()
 {
     if ($this->authData()) {
         $name = Input::get('name');
         $id = Customer::where('name', $name)->pluck('id');
         $user = Customer::find($id);
         Auth::login($user);
         if (Auth::check()) {
             Session::put('isAdmin', TRUE);
             return Redirect::to('admin/index.html');
         } else {
             $result = ['err' => 1001, 'msg' => '登录失败'];
         }
     } else {
         $result = ['err' => 1001, 'msg' => '验证不通过'];
     }
     return Response::json($result);
 }
开发者ID:GBPcoder,项目名称:tpanel,代码行数:18,代码来源:ApiController.php

示例11: indexAction

 public function indexAction()
 {
     $numberPage = 1;
     $searchParams = array();
     if ($this->request->isPost()) {
         //$query = Criteria::fromInput($this->di, "Customer", $_POST);
         $keyword = trim($this->request->getPost("keyword", "striptags"));
         if (isset($keyword) && $keyword != '') {
             if (strlen($keyword) == 18) {
                 $searchParams = array("number = '" . $keyword . "'");
             } else {
                 $searchParams = array("name = '" . $keyword . "'");
             }
             //$this->persistent->searchParams = $query->getParams();
         } else {
             $this->flash->notice("请重新输入搜索条件");
         }
     } else {
         $numberPage = $this->request->getQuery("page", "int");
         if ($numberPage <= 0) {
             $numberPage = 1;
         }
     }
     $parameters = array();
     if ($searchParams) {
         $parameters = $searchParams;
     }
     $customer = Customer::find($parameters);
     if (count($customer) == 0) {
         $this->flash->notice("没有找到对应的合同");
     }
     $paginator = new Phalcon\Paginator\Adapter\Model(array("data" => $customer, "limit" => 10, "page" => $numberPage));
     $page = $paginator->getPaginate();
     $this->view->setVar("page", $page);
     $this->view->setVar("customer", $customer);
 }
开发者ID:lookingatsky,项目名称:zhonghewanbang,代码行数:36,代码来源:CustomerController.php

示例12: delete

 /**
  * Remove the specified resource from storage.
  * DELETE /adminbuildings/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function delete($id)
 {
     $customer = Customer::find($id);
     $public_path = public_path() . $this->public_path;
     $image_fields = $this->image_fields;
     for ($i = 0; $i < count($image_fields); $i++) {
         if (file_exists($public_path . $customer->{$image_fields}[$i])) {
             File::delete($public_path . $customer->{$image_fields}[$i]);
         }
     }
     Customer::destroy($id);
     return Redirect::back();
 }
开发者ID:syafdia,项目名称:PAS,代码行数:20,代码来源:CustomersController.php

示例13: function

|
| The CSRF filter is responsible for protecting your application against
| cross-site request forgery attacks. If this special token in a user
| session does not match the one given in this request, we'll bail.
|
*/
Route::filter('csrf', function () {
    if (Session::token() !== Input::get('_token')) {
        throw new Illuminate\Session\TokenMismatchException();
    }
});
/*
|--------------------------------------------------------------------------
| Admin Filter
|--------------------------------------------------------------------------
|
| Check to determine if currently logged in user is an Administrator,
| based on the 'admin_ind' database flag.
|
*/
Route::filter('admin', function () {
    if (Auth::guest()) {
        return Redirect::route('login')->with('message', 'You must log in to access admin area of site.');
    } else {
        $customer = Customer::find(Auth::id());
        Log::debug('Admin filter - customer: ' . print_r($customer, TRUE));
        if (!$customer->admin_ind) {
            return Redirect::route('home')->with('message', '<strong>You are not authorized to access admin area of site.</strong>');
        }
    }
});
开发者ID:marciocamello,项目名称:laravel-ecommerce,代码行数:31,代码来源:filters.php

示例14: array

									<li><!-- HOME -->
										<a  href="{{URL::Route('home')}}">
											HOME
										</a>
										
									</li>
									@if(Auth::check())
									<?php 
$data = array("first_name" => "User");
$id = Auth::user()->id;
switch (Auth::user()->type) {
    case 'driver':
        $data = Driver::find($id)->toArray();
        break;
    case 'customer':
        $data = Customer::find($id)->toArray();
        break;
    case 'business':
        $data = Business::find($id)->toArray();
        break;
}
?>
									<li><!-- HOME -->
										<a  href="{{URL::Route('edit')}}">
											Edit
										</a>
										
									</li>
									<li class="dropdown">
										<a class="dropdown-toggle" href="#">
											Hi! {{$data["first_name"]}}
开发者ID:prateekchandan,项目名称:dipatchtaxicab-server,代码行数:31,代码来源:template.blade.php

示例15: createQuotation

 /**
  * Generates quotation requests
  *
  * @param int $customerId
  * @return Response
  * @author Gat
  **/
 public function createQuotation($customerId)
 {
     $directAward = Input::get('award') ? true : false;
     $customer = Customer::find($customerId);
     $secretary = Auth::user();
     // Check if customer has a representative
     if ($customer->representatives->isEmpty()) {
         return Redirect::route('customers.edit', ['id' => $customerId])->with('message', 'Add a customer representative first')->with('alert-class', 'danger');
     }
     // Get Initials
     $initialsPatern = '~\\b(\\w)|.~';
     $customerInitials = preg_replace($initialsPatern, '$1', $customer->name);
     $secretaryInitials = preg_replace($initialsPatern, '$1', $secretary->full_name);
     // TEMPORARY
     // RFQ = Customer's Initials - DDMM - Secretary's Initials
     $rfq = $customerInitials . '-' . date('dm') . '-' . $secretaryInitials;
     // Append number if existing
     $quotations = Quotation::where('rfq_id', 'LIKE', "{$rfq}%");
     if ($quotations->count()) {
         $rfq = $rfq . '-' . $quotations->count();
     }
     // Create quotation
     $quotation = Quotation::create(['customer_id' => $customer->id, 'secretary_id' => $secretary->id, 'rfq_id' => $rfq, 'direct_award' => $directAward]);
     return Redirect::route('quotations.request', ['rfq' => Str::slug($rfq)]);
 }
开发者ID:razerbite,项目名称:frisco_foundry,代码行数:32,代码来源:SalesController.php


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