• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP models\Customer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: actionCreateMultipleModels

 public function actionCreateMultipleModels()
 {
     $models = [];
     if (isset($_POST['Customer'])) {
         $validateOK = true;
         foreach ($_POST['Customer'] as $postObj) {
             $model = new Customer();
             $model->attributes = $postObj;
             $models[] = $model;
             $validateOK = $validateOK && $model->validate();
         }
         // All models are validated and will be saved
         if ($validateOK) {
             foreach ($models as $model) {
                 $model->save();
             }
             // Redirect to grid after save
             return $this->redirect(['grid']);
         }
     } else {
         for ($k = 0; $k < 3; $k++) {
             $models[] = new Customer();
         }
     }
     return $this->render('createMultipleModels', ['models' => $models]);
 }
开发者ID:QiLiuXianSheng,项目名称:yii2,代码行数:26,代码来源:CustomersController.php


示例2: checkSaleCredential

 private function checkSaleCredential(Customer $customer, $sale)
 {
     if ($sale = '1元专区') {
         return !$customer->hasPurchesedOneSale();
     }
     return true;
 }
开发者ID:whplay,项目名称:ohmate-shop,代码行数:7,代码来源:OrderController.php


示例3: save

 function save(array $params)
 {
     $response = new ResponseEntity();
     DB::transaction(function () use(&$response, $params) {
         $user = User::find(Auth::user()->id);
         $product = Product::find($params['product_id']);
         $cust = new Customer();
         $cust->first_name = $params['customer']['first_name'];
         $cust->last_name = $params['customer']['last_name'];
         $cust->phone_number = $params['customer']['phone_number'];
         $custCreated = $cust->save();
         if ($custCreated && $product && $user) {
             $sale = new Sale();
             $sale->user_id = $user->id;
             $sale->sale_status_id = Config::get('constants.sale_status.sale');
             $sale->product_id = $product->id;
             $sale->customer_id = $cust->id;
             $sale->date_sold = Carbon::createFromFormat('m/d/Y', $params['date_sold'])->toDateString();
             $sale->remarks = isset($params['remarks']) ? $params['remarks'] : '';
             $sale->order_number = $params['order_number'];
             $sale->ninety_days = isset($params['ninety_days']) ?: 0;
             $ok = $sale->save();
             if ($ok) {
                 $ok = $this->setIncentive($sale->user_id, $sale->date_sold);
                 $response->setMessages($ok ? ['Sale successfully created!'] : ['Failed to create sale!']);
                 $response->setSuccess($ok);
             } else {
                 $response->setMessages(['Failed to create sale!']);
             }
         } else {
             $response->setMessages(['Entities not found']);
         }
     });
     return $response;
 }
开发者ID:arjayads,项目名称:green-tracker,代码行数:35,代码来源:SaleService.php


示例4: actionPayment

 public function actionPayment()
 {
     if (\Yii::$app->session->has('customer')) {
         $modelCustomer = new Customer();
         $infoCustomer = $modelCustomer->getInformation($_SESSION['customer']);
         $modelOrder = new Order();
         $modelOrderDetail = new OrderDetail();
         $modelProduct = new Product();
         $ids = array();
         foreach ($_SESSION['cart_items'] as $id => $quantity) {
             array_push($ids, $id);
         }
         $products = $modelProduct->getWithIDs($ids);
         if (\Yii::$app->request->post()) {
             $modelOrder->load(\Yii::$app->request->post());
             $modelOrder->save();
             $orderId = $modelOrder->id;
             foreach ($_SESSION['cart_items'] as $id => $quantity) {
                 $unitPrice = $modelProduct->getPrice($id) * $quantity;
                 \Yii::$app->db->createCommand()->insert('order_detail', ['orderId' => $orderId, 'productId' => $id, 'unitPrice' => $unitPrice, 'quantity' => $quantity])->execute();
             }
             \Yii::$app->session->remove('cart_items');
             return $this->redirect(['cart/index', 'success' => 'Thanh toán thành công! Chúng tôi sẽ liên hệ bạn trong thời gian sớm nhất! Xin cảm ơn!']);
         } else {
             return $this->render('payment', ['infoCustomer' => $infoCustomer, 'modelOrder' => $modelOrder, 'products' => $products]);
         }
     } else {
         $this->redirect(['customer/login', 'error' => 'Vui lòng đăng nhập trước khi thanh toán']);
     }
 }
开发者ID:royutoan,项目名称:pianodanang,代码行数:30,代码来源:CartController.php


示例5: actionCreateMultipleModels

 public function actionCreateMultipleModels()
 {
     $models = [];
     $OK = true;
     if (isset($_POST['Customer'])) {
         foreach ($_POST['Customer'] as $postObj) {
             $customer = new Customer();
             $customer->attributes = $postObj;
             $isValid = $customer->validate();
             $OK = $OK && $isValid;
             $models[] = $customer;
         }
         if ($OK) {
             foreach ($models as $model) {
                 $model->save();
             }
             $this->redirect('customers/grid');
         }
     } else {
         for ($i = 0; $i < 3; $i++) {
             $models[] = new Customer();
         }
     }
     return $this->render('createMultipleModels', compact('models'));
 }
开发者ID:soanni,项目名称:yii2news,代码行数:25,代码来源:CustomersController.php


示例6: create

 /**
  * O método precisa informar uma lista de produtos
  * @return {view}
  */
 public function create()
 {
     $stocks = Stock::all();
     $customers = Customer::all();
     $employees = Employee::all();
     return view('pages.new_sale', ['stocks' => $stocks, 'customers' => $customers, 'employees' => $employees]);
 }
开发者ID:bsampaio,项目名称:LumenExperience,代码行数:11,代码来源:SaleController.php


示例7: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $role = Role::where('name', 'admin')->first();
     $customer = Customer::create(['name' => 'test']);
     $customer->user()->save(new User(['email' => '[email protected]', 'password' => bcrypt('testing')]));
     $customer->user->assignRole($role);
 }
开发者ID:RichardMarbach,项目名称:mkdir,代码行数:12,代码来源:UserTableSeeder.php


示例8: index

	public function index(){
		$data = [
			'auth'=>false,
			'recentAdded'=>Customer::orderBy('created_at', 'desc')->take(5)->get()
		];
		return view('home', $data);
	}
开发者ID:nekoTheGreat,项目名称:CustomerMgt,代码行数:7,代码来源:HomeController.php


示例9: getSearch

 public function getSearch(Request $request)
 {
     $q = $request->get('q');
     $limit = $request->get('limit', 5);
     $customers = Customer::where('mobile_phone', 'like', $q . '%')->with('addresses')->paginate($limit);
     return $customers;
 }
开发者ID:noodle-learns-programming,项目名称:laravel,代码行数:7,代码来源:CustomerController.php


示例10: approveApplication

 public function approveApplication(Request $request)
 {
     $shop_card_application_id = $request->input('require_id');
     $application = ShopCardApplication::find($shop_card_application_id);
     $customer = Customer::find($application->customer_id);
     $card_type = $application->cardType;
     try {
         \DB::transaction(function () use($application, $customer, $card_type) {
             $customer_rows = \DB::table('customers')->where('id', $customer->id);
             $customer_rows->lockForUpdate();
             $customer_row = $customer_rows->first();
             if ($customer_row->beans_total < $card_type->beans_value * $application->amount) {
                 throw new NotEnoughBeansException();
             }
             $cards = \DB::table('shop_cards')->where('card_type_id', '=', $card_type->id)->whereNull('customer_id')->limit($application->amount);
             $cards->lockForUpdate();
             if ($cards->count() < $application->amount) {
                 throw new CardNotEnoughException();
             }
             $customer->minusBeansByHand($application->amount * $card_type->beans_value);
             $cards->update(['customer_id' => $customer->id, 'bought_at' => Carbon::now()]);
             $application->update(['authorized' => true]);
             return true;
         });
     } catch (CardNotEnoughException $e) {
         return '相应卡片不足,无法继续。';
     } catch (NotEnoughBeansException $e) {
         return '用户迈豆不足!';
     }
     return "操作成功!";
 }
开发者ID:whplay,项目名称:ohmate-shop,代码行数:31,代码来源:CardApplicationController.php


示例11: index

 public function index()
 {
     $c = Customer::get();
     $bankaccount = Bankaccount::joining();
     $voucher = Voucher::orderBy('id', 'desc')->where('type', 5)->take(10)->get();
     return view('contravouchar', compact('bankaccount', 'c', 'voucher'));
 }
开发者ID:richardkeep,项目名称:prct,代码行数:7,代码来源:ContravoucherController.php


示例12: detail

 /**
  * Display a customer
  *
  * @return Response
  */
 public function detail($id = null)
 {
     $result = \App\Models\Customer::id($id)->with(['sales', 'myreferrals', 'myreferrals.user'])->first();
     if ($result) {
         return new JSend('success', (array) $result->toArray());
     }
     return new JSend('error', (array) Input::all(), 'ID Tidak Valid.');
 }
开发者ID:ThunderID,项目名称:SHOP-API,代码行数:13,代码来源:CustomerController.php


示例13: report

 public function report()
 {
     $s = Supplier::get();
     $c = Customer::get();
     $bankaccount = Bankaccount::joining();
     $voucher = Voucher::orderBy('id', 'desc')->take(10)->get();
     return view('ledger', compact('bankaccount', 'c', 's', 'voucher'));
 }
开发者ID:richardkeep,项目名称:prct,代码行数:8,代码来源:CustomersledgerController.php


示例14: actionLogin

 public function actionLogin()
 {
     $model = new Customer();
     if ($model->load(Yii::$app->request->post())) {
         $request = Yii::$app->request->post('Customer');
         $username = $request['username'];
         $password = $request['password'];
         if ($model->checkLogin($username, $password)) {
             $customerName = $model->getName($username);
             Yii::$app->session->set('customer', $customerName);
             $this->redirect(['site/index']);
         } else {
             $this->redirect(['login', 'error' => 'Tên đăng nhập hoặc mật khẩu không đúng!']);
         }
     }
     return $this->render('login', ['model' => $model]);
 }
开发者ID:royutoan,项目名称:pianodanang,代码行数:17,代码来源:CustomerController.php


示例15: test

 public function test()
 {
     $customer = Customer::where('openid', 'oUS_vt3J8ClZx4q1wmx6VBJ1KfwQ')->firstOrFail();
     $end = new \DateTime(Carbon::now()->format('Y-m'));
     $begin = new \DateTime($customer->created_at->format('Y-m'));
     $month = \Helper::getDatePeriod($begin, $end);
     dd($month);
 }
开发者ID:whplay,项目名称:ohmate-shop,代码行数:8,代码来源:TestController.php


示例16: showDetail

 public function showDetail($id)
 {
     $customer = Customer::where('kode', $id)->firstOrFail();
     $reservation = Reservation::where('customer_kode', $id)->orderBy('created_at', 'desc')->firstOrFail();
     $transaksi = Reservation::where('customer_kode', $id)->orderBy('id', 'desc')->get();
     $sisabayar = DB::table('reservation')->where('customer_kode', '=', $id)->sum('cash');
     $tagihan = $reservation->total - $sisabayar;
     return view('reservation.detail', compact('customer', 'reservation', 'tagihan', 'transaksi'));
 }
开发者ID:aimtux,项目名称:lavhotel,代码行数:9,代码来源:PesanController.php


示例17: 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)
 {
     $this->validation_rules($request);
     $customerUpdate = $request->input();
     $customer = Customer::find($id);
     $customer->update($customerUpdate);
     Session::flash('flash_message', 'Data pelanggan berhasil diupdate!');
     return redirect('admin/customer');
 }
开发者ID:thesaputra,项目名称:xyz-prx,代码行数:16,代码来源:CustomerController.php


示例18: getDelete

 public function getDelete($id)
 {
     $table = null;
     if (!empty($id)) {
         $table = Customer::whereId($id);
         $table->delete();
     }
     return response()->json(array('msg' => 'ok', 'state' => 1, 'data' => null));
 }
开发者ID:josmel,项目名称:hostpots,代码行数:9,代码来源:AdminController.php


示例19: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $customer = Customer::find($id);
     if (!$customer) {
         return response()->json('Le client n\'existe pas.', 404);
     }
     $customer->delete();
     return 'Le client a bien été supprimé.';
 }
开发者ID:oarGroupeCesi,项目名称:madera_api,代码行数:15,代码来源:CustomerController.php


示例20: testInvite

 public function testInvite()
 {
     $c = Customer::find(3);
     $counter = new CustomerInvitationCounter(Customer::find(1));
     $before = $counter->getMonthlyCount();
     //        $this->assertEquals(0, $before);
     event(new Register($c));
     $after = $counter->getMonthlyCount();
     $this->assertEquals($before + 1, $after);
 }
开发者ID:whplay,项目名称:ohmate-shop,代码行数:10,代码来源:ExampleTest.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP models\Event类代码示例发布时间:2022-05-23
下一篇:
PHP models\Currency类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap