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


PHP Customer::where方法代码示例

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


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

示例1: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     //
     parent::boot($router);
     /*Route::model*/
     /**
      * Route model binding altering default logic
      * $router->bind('articles',function($id){
      *     return \App\Article::published()->findOrFail($id);
      * });
      */
     /*Using wildcard*/
     /*$router->model('articles','App\Article');*/
     $router->bind('articles', function ($id) {
         return \App\Article::published()->findOrFail($id);
     });
     $router->bind('rates', function ($id) {
         return \App\Rate::where('id', $id)->firstOrFail();
     });
     $router->bind('customers', function ($id) {
         return \App\Customer::where('id', $id)->firstOrFail();
     });
     $router->bind('tags', function ($name) {
         return \App\Tag::where('name', $name)->firstOrFail();
     });
     $router->bind('motherboards', function ($name) {
         return \App\Motherboard::where('name', $name)->firstOrFail();
     });
 }
开发者ID:sephestrito,项目名称:learning-laravel-5,代码行数:35,代码来源:RouteServiceProvider.php

示例2: profileUpdate

 /**
  * Get request from profile form and update the fields of the Customer instance.
  * Then redirect to their intended location or '/'
  *
  * @param Request $request
  * @return \Illuminate\Http\RedirectResponse
  */
 public function profileUpdate(UpdateProfileRequest $request)
 {
     // Retrieve all data in $request to an array
     $data = $request->all();
     // Find and retrieve the appropriate Customer instance
     $customer = Customer::where('email', Auth::user()->email)->first();
     // Update the details
     $customer->name = $data['name'];
     $customer->NIC_passport_num = $data['ID'];
     $customer->telephone_num = $data['telephone'];
     $customer->address_line_1 = $data['address_line1'];
     $customer->address_line_2 = $data['address_line2'];
     $customer->city = $data['city'];
     $customer->province_state = $data['province'];
     $customer->zip_code = $data['zipCode'];
     $customer->country = $data['country'];
     // Save the updated Customer instance
     $customer->save();
     //this lines are added, if the user is facebook logged in user he needs to fill his other details and he should be
     //redirected to payment page, since return redirect()->intended() is not working for this purpose
     if (Session::has('fblogin_payment')) {
         return redirect('payment');
     }
     return redirect()->intended('/')->with('success', 'Your details have been updated successfully.');
 }
开发者ID:nilesh93,项目名称:HOTEL_RESERVATION,代码行数:32,代码来源:RegisteredUsersController.php

示例3: single

 public function single($mr, $currentMonth)
 {
     $actualVisits = [];
     $MonthlyCustomerProducts = [];
     $MRLine = [];
     $doctors = Customer::where('mr_id', $mr)->get();
     foreach ($doctors as $singleDoctor) {
         $actualVisits[$singleDoctor->id] = Report::where('mr_id', $mr)->where('month', $currentMonth)->where('doctor_id', $singleDoctor->id)->count();
         $MonthlyCustomerProducts[$singleDoctor->id] = Customer::monthlyProductsBought([$singleDoctor->id])->toArray();
     }
     $products = Product::where('line_id', Employee::findOrFail($mr)->line_id)->get();
     $coverageStats = Employee::coverageStats($mr, $currentMonth);
     $allManagers = Employee::yourManagers($mr);
     $totalProducts = Employee::monthlyDirectSales($mr, $currentMonth);
     $totalSoldProductsSales = $totalProducts['totalSoldProductsSales'];
     $totalSoldProductsSalesPrice = $totalProducts['totalSoldProductsSalesPrice'];
     $currentMonth = \Carbon\Carbon::parse($currentMonth);
     $lines = MrLines::select('line_id', 'from', 'to')->where('mr_id', $mr)->get();
     foreach ($lines as $line) {
         $lineFrom = \Carbon\Carbon::parse($line->from);
         $lineTo = \Carbon\Carbon::parse($line->to);
         if (!$currentMonth->lte($lineTo) && $currentMonth->gte($lineFrom)) {
             $MRLine = MrLines::where('mr_id', $mr)->where('line_id', $line->line_id)->get();
         }
     }
     $dataView = ['doctors' => $doctors, 'MonthlyCustomerProducts' => $MonthlyCustomerProducts, 'actualVisits' => $actualVisits, 'products' => $products, 'totalVisitsCount' => $coverageStats['totalVisitsCount'], 'actualVisitsCount' => $coverageStats['actualVisitsCount'], 'totalMonthlyCoverage' => $coverageStats['totalMonthlyCoverage'], 'allManagers' => $allManagers, 'totalSoldProductsSales' => $totalSoldProductsSales, 'totalSoldProductsSalesPrice' => $totalSoldProductsSalesPrice, 'MRLines' => $MRLine];
     return view('am.line.single', $dataView);
 }
开发者ID:m-gamal,项目名称:crm,代码行数:28,代码来源:LineController.php

示例4: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['subject' => 'required|max:255', 'product' => 'required', 'group' => 'required', 'severity' => 'required', 'description' => 'required']);
     $settings = Settings::where('name', 'ticket_track_id')->first();
     $track_id = $settings->str_value;
     $customer = Customer::where('id', $this->my_customer_id)->first();
     $search_strings = ['%COMPANY_NAME', '%Y', '%m', '%d'];
     $value_strings = [str_replace(' ', '_', $customer->name), date('Y', time()), date('m', time()), date('d', time())];
     $track_id = str_replace($search_strings, $value_strings, $track_id);
     $ticket = Ticket::create(['subject' => $request->subject, 'track_id' => $track_id, 'description' => $request->description, 'group_id' => $request->group, 'severity_id' => $request->severity, 'product_id' => $request->product, 'user_id' => $this->my_id, 'customer_id' => $this->my_customer_id, 'status_id' => 1]);
     if (isset($request->attachments)) {
         foreach ($request->attachments as $attachment) {
             // Check that the directory exists
             $uploadPath = storage_path() . '/attachments/' . $ticket->id;
             $fs = new Filesystem();
             if (!$fs->isDirectory($uploadPath)) {
                 // Create the directory
                 $fs->makeDirectory($uploadPath);
             }
             $attachment->move($uploadPath, $attachment->getClientOriginalName());
             $_attachment = Attachment::create(['user_id' => $this->my_id, 'name' => $attachment->getClientOriginalName(), 'ticket_id' => $ticket->id]);
         }
     }
     $this->dispatch(new EmailNewTicket($ticket));
     return redirect('/tickets');
 }
开发者ID:stryker250,项目名称:simple_ticket,代码行数:32,代码来源:TicketController.php

示例5: stores

 public function stores()
 {
     $accounts = Account::all();
     $data = array();
     foreach ($accounts as $account) {
         $customers = Customer::where('account_id', $account->id)->get();
         $account_children = array();
         foreach ($customers as $customer) {
             $areas = Area::where('customer_id', $customer->id)->get();
             $customer_children = array();
             foreach ($areas as $area) {
                 $regions = Region::where('area_id', $area->id)->get();
                 $area_children = array();
                 foreach ($regions as $region) {
                     $distributors = Distributor::where('region_id', $region->id)->get();
                     $region_children = array();
                     foreach ($distributors as $distributor) {
                         $stores = Store::where('distributor_id', $distributor->id)->get();
                         $distributor_children = array();
                         foreach ($stores as $store) {
                             $distributor_children[] = array('title' => $store->store, 'key' => $account->id . "." . $customer->id . "." . $area->id . "." . $region->id . "." . $distributor->id . "." . $store->id);
                         }
                         $region_children[] = array('select' => true, 'title' => $distributor->distributor, 'isFolder' => true, 'key' => $account->id . "." . $customer->id . "." . $area->id . "." . $region->id . "." . $distributor->id, 'children' => $distributor_children);
                     }
                     $area_children[] = array('select' => true, 'title' => $region->region, 'isFolder' => true, 'key' => $account->id . "." . $customer->id . "." . $area->id . "." . $region->id, 'children' => $region_children);
                 }
                 $customer_children[] = array('select' => true, 'title' => $area->area, 'isFolder' => true, 'key' => $account->id . "." . $customer->id . "." . $area->id, 'children' => $area_children);
             }
             $account_children[] = array('select' => true, 'title' => $customer->customer, 'isFolder' => true, 'key' => $account->id . "." . $customer->id, 'children' => $customer_children);
         }
         $data[] = array('title' => $account->account, 'isFolder' => true, 'key' => $account->id, 'children' => $account_children);
     }
     return response()->json($data);
 }
开发者ID:renciebautista,项目名称:perfectstore,代码行数:34,代码来源:StoreController.php

示例6: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $customer = Customer::where('id', $id)->orWhere('slug', $id)->firstOrFail();
     $snippets = $customer->snippets;
     $persons = $customer->persons;
     return view('customers.show', compact('customer', 'snippets', 'persons'));
 }
开发者ID:starkbaum,项目名称:sucon,代码行数:13,代码来源:CustomersController.php

示例7: userHistoric

 public function userHistoric()
 {
     $user_id = Auth::user()->id;
     $customer_id = Customer::where('user_id', '=', $user_id)->value('id');
     $histories = History::where('customer_id', '=', $customer_id)->get();
     return view('front.user_historic', compact('histories'));
 }
开发者ID:jbcharrier,项目名称:Projet-Ecole-Multimedia-StarWars-Store,代码行数:7,代码来源:FrontController.php

示例8: search

 public function search()
 {
     $products = Product::where('line_id', Employee::find(\Auth::user()->id)->line_id)->get();
     $doctors = Customer::where('mr_id', \Auth::user()->id)->get();
     $dataView = ['products' => $products, 'doctors' => $doctors];
     return view('mr.search.sales.search', $dataView);
 }
开发者ID:m-gamal,项目名称:crm,代码行数:7,代码来源:SaleController.php

示例9: getViewCustomer

 public function getViewCustomer($id)
 {
     $customer = Customer::where("id", $id)->with("companies")->with("user")->with(['jobs' => function ($q) {
         $q->where("company_id", Auth::user()->company_id);
     }])->first();
     $total = Job::where("customer_id", $id)->count();
     return view("customer", ["customer" => $customer, "total" => $total]);
 }
开发者ID:younggeeks,项目名称:twentyKitonga,代码行数:8,代码来源:TestController.php

示例10: gymaccess

 public function gymaccess($id)
 {
     $customer = \App\Customer::where('id', $id)->firstOrFail();
     /*$activationDate = Carbon::today();*/
     $activationDate = Carbon::today()->format('F d\\, Y');
     $rates = Rate::where('member_ind', $customer->membership_ind)->where('per_session_ind', '!=', 1)->lists('rate', 'id', 'price');
     return view('customers.gymaccess', compact('customer', 'rates', 'activationDate'));
 }
开发者ID:sephestrito,项目名称:learning-laravel-5,代码行数:8,代码来源:CustomersController.php

示例11: userExists

 protected function userExists($data)
 {
     $customer = Customer::where('email', $data['email'])->first();
     if ($customer == '' || empty($customer)) {
         return false;
     } else {
         return true;
     }
 }
开发者ID:abhilash698,项目名称:projectc,代码行数:9,代码来源:ApiController.php

示例12: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     if (Auth::user()->admin == 1) {
         $customer = Customer::findOrFail($id);
     } else {
         $customer = Customer::where('group', Auth::user()->group)->where('id', $id)->firstOrFail();
     }
     return view('customer.show', ['customer' => $customer]);
 }
开发者ID:Balauue,项目名称:komilitona,代码行数:15,代码来源:CustomerController.php

示例13: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     //         return view('customer.show');
     $search = \Request::get('search');
     //<-- we use global request to get the param of URI
     $customers = Customer::where('name', 'like', '%' . $search . '%')->orderBy('name')->paginate(20);
     return view('customer.list', array('customers' => $customers));
     //     $customers = Customer::all();
     //       return view('customer.list', array('customers' => $customers));
 }
开发者ID:owlein,项目名称:laundrymgt,代码行数:15,代码来源:CustomerController.php

示例14: customers

 public function customers()
 {
     $search = \Input::get('q');
     if ($search) {
         $customers = \App\Customer::where('firstname', 'like', $search . '%')->orWhere('lastname', 'like', $search . '%')->orderBy('created_at', 'desc')->paginate($this->limit);
     } else {
         $customers = \App\Customer::orderBy('created_at', 'desc')->paginate($this->limit);
     }
     return view('admin.pages.customers', compact('customers'));
 }
开发者ID:candrasetiadi,项目名称:nvjvnjsdnnvdvdw,代码行数:10,代码来源:AdminController.php

示例15: customers

 public function customers()
 {
     $term = \Input::get('term');
     $customers = Customer::where('customer_name', 'like', "%{$term}%")->orderBy('customer_name', 'asc')->get();
     $json = [];
     foreach ($customers as $c) {
         array_push($json, array('value' => $c->id, 'label' => $c->customer_name));
     }
     return response()->json($json);
 }
开发者ID:AlexAustralia,项目名称:printflow,代码行数:10,代码来源:JsonController.php


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