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


PHP Customer::fill方法代码示例

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


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

示例1: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Customer $cus, Request $request)
 {
     //
     $data = $request->all();
     $data['created_by'] = \Auth::user()->id;
     $data['updated_by'] = \Auth::user()->id;
     $data['is_active'] = 1;
     $cus->fill($data)->save();
     return Redirect::route('customers.index');
 }
开发者ID:sethathay,项目名称:PPBakery,代码行数:16,代码来源:CustomersController.php

示例2: save

 public function save(Request $request)
 {
     if (!Customer::whereCustomer_id($request->customer_id)->first()) {
         $customer = new Customer();
         $customer->fill($request->all());
         $customer->save();
         return redirect("/customer/" . $customer->id . "/show");
     } else {
         return redirect("/customer/create")->with("status", Alert::get("danger", "Kund " . $request->customer_id . " existerar, försök igen."));
     }
 }
开发者ID:znittzel,项目名称:datianew,代码行数:11,代码来源:CustomerController.php

示例3: store

 /**
  * Store a newly created resource in storage.
  *
  * @param \App\Http\Requests\CreateCustomerValidation|\Illuminate\Http\Request $request
  * @return \Illuminate\Http\Response
  */
 public function store(CreateCustomerValidation $request)
 {
     $input = $request->all();
     $customer = new Customer();
     $customer->fill($input);
     if ($customer->save()) {
         $this->setMessage('Customer was successfully created!');
     } else {
         $this->setMessage('Oops... Customer was not created.  Please try again', 'error');
     }
     return redirect('/customers');
 }
开发者ID:smadeira,项目名称:yellowBucketLaravel,代码行数:18,代码来源:CustomerController.php

示例4: process

 public function process($fileContents)
 {
     //set_time_limit( 800 );
     $fileLines = explode("\r\n", $fileContents);
     $maxLineCount = count($fileLines);
     $user = Auth::user();
     for ($x = 0; $x < $maxLineCount; $x++) {
         if ($x == 0) {
             continue;
         }
         $lineArray = explode("\t", $fileLines[$x]);
         $customerEmail = @$lineArray[10];
         $customerName = @$lineArray[11];
         $amazonOrderId = @$lineArray[0];
         $recipientName = @$lineArray[24];
         $amazonOrderItemId = @$lineArray[4];
         $itemQuantity = @$lineArray[15];
         $productSku = @$lineArray[13];
         $productName = @$lineArray[14];
         $productPrice = @$lineArray[17];
         $shipAddress1 = @$lineArray[25];
         $shipAddress2 = @$lineArray[26];
         $shipAddress3 = @$lineArray[27];
         $shipCity = @$lineArray[28];
         $shipState = @$lineArray[29];
         $shipPostalCode = @$lineArray[30];
         $shipCountry = @$lineArray[31];
         $carrier = @$lineArray[42];
         $trackingNumber = @$lineArray[43];
         $itemPromotionDiscount = @$lineArray[40];
         $customer = Customer::where('email', '=', $customerEmail)->where('user_id', '=', $user->id)->first();
         if (!$customer) {
             $customer = new Customer();
             $customer->fill(['email' => $customerEmail, 'name' => $customerName]);
             $customer = $user->customers()->save($customer);
         } else {
             $customer->name = $customerName;
             $customer->save();
         }
         $transaction = Transaction::where('amazon_order_id', '=', $amazonOrderId)->where('customer_id', '=', $customer->id)->first();
         if (!$transaction) {
             $transaction = new Transaction();
             $transactionData = ['amazon_order_id' => $amazonOrderId, 'recipient_name' => $recipientName, 'ship_address_1' => $shipAddress1, 'ship_address_2' => $shipAddress2, 'ship_address_3' => $shipAddress3, 'ship_city' => $shipCity, 'ship_state' => $shipState, 'ship_postal_code' => $shipPostalCode, 'ship_postal_country' => $shipCountry, 'carrier' => $carrier, 'tracking_number' => $trackingNumber];
             $transaction->fill($transactionData);
             $transaction = $customer->transactions()->save($transaction);
         } else {
             $transaction->recipient_name = $recipientName;
             $transaction->save();
         }
         $productSku = str_replace('-', '', $productSku);
         // Products ...
         $product = AmazonProduct::whereSku($productSku)->where('user_id', '=', $user->id)->first();
         if (!$product) {
             $product = new AmazonProduct();
             $product->fill(['sku' => $productSku, 'name' => $productName, 'price' => $productPrice]);
             $product = $user->products()->save($product);
         } else {
             $product->name = $productName;
             $product->price = $productPrice;
             $product->save();
         }
         if ($itemPromotionDiscount != 0) {
             $payout = $itemQuantity * ($product->price - $itemPromotionDiscount);
         } else {
             $payout = $itemQuantity * $product->price;
         }
         $transactionItem = TransactionItem::whereAmazonOrderItemId($amazonOrderItemId)->where('transaction_id', '=', $transaction->id)->first();
         if (!$transactionItem) {
             $transactionItem = new TransactionItem();
             $arrayData = ['amazon_product_id' => $product->id, 'amazon_order_item_id' => $amazonOrderItemId, 'quantity' => $itemQuantity, 'payout' => $payout];
             $transactionItem->fill($arrayData);
             $transaction->items()->save($transactionItem);
         } else {
             $transactionItem->amazon_product_id = $product->id;
             $transactionItem->quantity = $itemQuantity;
             $transactionItem->payout = $payout;
             $transactionItem->save();
         }
     }
     return $this->json->success('SUCCESS!!! Import data done ....');
 }
开发者ID:aljogabot,项目名称:AmazonStats,代码行数:81,代码来源:ImportDataController.php


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