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


PHP Customer::salesman方法代码示例

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


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

示例1: update

 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(Request $request, $id)
 {
     //
     $rules = array('projectNum' => 'required', 'create_at' => 'required', 'pjsales' => 'required', 'pjContacter' => 'required', 'pjContacterPhone' => 'required', 'pjContacterEmail' => 'email|required', 'cmCode' => 'required', 'cmShort' => 'required', 'e_shortName' => 'required', 'customer_id' => 'required', 'c_name' => 'required', 'institute' => 'required', 'department' => 'required', 'email' => 'email|required', 'contacter' => 'required', 'contacterPhone' => 'required', 'contacterEmail' => 'email|required', 'address' => 'required', 'sales' => 'required', 'PJclass' => 'required', 'PJservice' => 'required', 'PJspecies' => 'required');
     $validator = Validator::make($request->all(), $rules);
     if ($validator->fails()) {
         return back()->withErrors($validator)->withInput();
     }
     $customer_id = $request->get('customer_id');
     if ($customer_id == 0) {
         $customer = new Customer(array('cmCode' => $request->get('cmCode'), 'cmShort' => $request->get('cmShort'), 'c_name' => $request->get('c_name'), 'e_shortName' => $request->get('e_shortName'), 'institute' => $request->get('institute'), 'department' => $request->get('department'), 'fax' => $request->get('fax'), 'phone' => $request->get('phone'), 'email' => $request->get('email'), 'contacter' => $request->get('contacter'), 'contacterPhone' => $request->get('contacterPhone'), 'contacterEmail' => $request->get('contacterEmail'), 'address' => $request->get('address'), 'salesman' => $request->get('sales')));
         $salesman = User::findOrFail($request->get('sales'));
         $customer->salesman()->associate($salesman);
         $customer->save();
     } else {
         $customer = Customer::findOrFail($customer_id);
         $customer->update(['cmCode' => $request->get('cmCode'), 'cmShort' => $request->get('cmShort'), 'c_name' => $request->get('c_name'), 'e_shortName' => $request->get('e_shortName'), 'institute' => $request->get('institute'), 'department' => $request->get('department'), 'fax' => $request->get('fax'), 'phone' => $request->get('phone'), 'email' => $request->get('email'), 'contacter' => $request->get('contacter'), 'contacterPhone' => $request->get('contacterPhone'), 'contacterEmail' => $request->get('contacterEmail'), 'address' => $request->get('address')]);
         $salesman = User::findOrFail($request->get('sales'));
         $customer->salesman()->associate($salesman);
         $customer->save();
     }
     $project = Project::findOrFail($id);
     if (empty($request->file('file'))) {
         $fileName = null;
     } else {
         $fileName = $project->id . '.' . $request->file('file')->getClientOriginalExtension();
         $request->file('file')->move(base_path() . '/storeFiles/ngs/quotation/', $fileName);
     }
     $user = \Auth::user();
     $project->user()->associate($user);
     $customer = Customer::findOrFail($customer_id);
     $project->customer()->associate($customer);
     $pjsalesman = User::findOrFail($request->get('pjsales'));
     $project->salesman = $pjsalesman->id;
     if ($request->get('PJservice') == 'Other') {
         $PJservice = $request->get('PJserviceNote');
     } else {
         $PJservice = $request->get('PJservice');
     }
     if (empty($fileName)) {
         $project->update(['projectNum' => $request->get('projectNum'), 'PJtype' => $request->get('PJtype'), 'PJclass' => $request->get('PJclass'), 'PJservice' => $PJservice, 'PJspecies' => $request->get('PJspecies'), 'note' => $request->get('note'), 'contacter' => $request->get('contacter'), 'contacterPhone' => $request->get('contacterPhone'), 'contacterEmail' => $request->get('contacterEmail')]);
     } else {
         $project->update(['projectNum' => $request->get('projectNum'), 'PJtype' => $request->get('PJtype'), 'PJclass' => $request->get('PJclass'), 'PJservice' => $PJservice, 'PJspecies' => $request->get('PJspecies'), 'note' => $request->get('note'), 'contacter' => $request->get('contacter'), 'contacterPhone' => $request->get('contacterPhone'), 'contacterEmail' => $request->get('contacterEmail'), 'fileName' => $fileName]);
     }
     return \Redirect::to('research/ngs/projects/index')->with('message', 'Your Project has been updated!');
 }
开发者ID:a5526000,项目名称:LIMS,代码行数:53,代码来源:ProjectController.php


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