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


PHP Customer::firstOrNew方法代码示例

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


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

示例1: store

 /**
  * Store the return items data 
  * 
  * @return ReturnController@index
  */
 public function store()
 {
     $input = Input::all();
     $customer = Customer::firstOrNew(['name' => $input['customer']]);
     $customer->address = $input['address'];
     $customer->save();
     $ret = new Ret();
     $ret->customer_id = $customer->id;
     $ret->date = $input['date'];
     $ret->reference_no = $input['ref_no'];
     $ret->salesman = $input['salesman'];
     $ret->area = $input['area'];
     $ret->received_by = $input['received_by'];
     $ret->checked_by = $input['checked_by'];
     $ret->save();
     foreach ($input['boxes'] as $i => $box) {
         $retItem = new ReturnItem();
         $retItem->ret_id = $ret->id;
         $retItem->box_id = $box;
         $retItem->no_of_box = $input['no_of_box'][$i];
         $retItem->no_of_packs = $input['no_of_packs'][$i];
         $retItem->amount = $input['amount'][$i];
         $retItem->product_id = Box::find($box)->product->id;
         $retItem->save();
     }
     return Redirect::action('InventoryController@index');
 }
开发者ID:MangTomas23,项目名称:tgm,代码行数:32,代码来源:ReturnController.php

示例2: store

 public function store()
 {
     $input = Input::all();
     $salesman = isset($input['salesman']) ? $input['salesman'] : null;
     $customer = Customer::firstOrNew(['name' => $input['name'], 'address' => $input['address']]);
     $customer->save();
     $order = new Order();
     $order->customer_id = $customer->id;
     $order->salesman_id = $salesman;
     $order->date = $input['date'];
     $order->type = $input['type'];
     $order->save();
     foreach ($input['box_id'] as $i => $box_id) {
         $orderItem = new OrderItem();
         $orderItem->order_id = $order->id;
         $orderItem->product_id = Box::find($box_id)->product->id;
         $orderItem->box_id = $box_id;
         $orderItem->no_of_box = $input['no_of_box'][$i];
         $orderItem->no_of_packs = $input['no_of_packs'][$i];
         $orderItem->amount = $input['amount'][$i];
         $orderItem->selling_price = $input['selling_price'][$i];
         $orderItem->save();
     }
     return view('order.addmore');
 }
开发者ID:MangTomas23,项目名称:tgm,代码行数:25,代码来源:OrderController.php

示例3: store

 public function store()
 {
     $input = Session::get('input');
     $customer = Customer::firstOrNew(['name' => $input['order_by']]);
     $customer->address = $input['address'];
     $customer->save();
     return Redirect::action('OrderController@create', compact('input'));
 }
开发者ID:MangTomas23,项目名称:tgm,代码行数:8,代码来源:CustomerController.php


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