コード例 #1
0
 public function update(CustomerUpdateRequest $request)
 {
     $customer = Customer::findOrFail($request->id);
     $oldsupplier = json_encode($customer);
     $customer->fill($request->postFillData());
     $customer->save();
     $customerid = $customer->id;
     $employeeid = Auth::user()->id;
     $log = ActivityLog::create(['employee_id' => $employeeid, 'activity' => 'Edit Suppliers', 'table_affected' => 'customer', 'primary_key' => $customerid, 'column_affected' => 'all', 'old_value' => $oldsupplier]);
     return redirect()->route('erp_system.customer.index')->withSuccess('Customer updated.');
 }
コード例 #2
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update(CustomerUpdateRequest $request, $id)
 {
     // $customer = Customer::find($id);
     // if($customer->email==Input::get('email')){
     // 	$email = Input::get('email');
     // }else{
     // 	//$email = $request->get('email');
     // }
     if ($request->get('role') == true) {
         $role = 1;
     } else {
         $role = 0;
     }
     $data = ['name' => $request->get('name'), 'email' => $request->get('email'), 'phone' => $request->get('phone'), 'address' => $request->get('address'), 'role' => $role];
     $customer = Customer::find($id);
     $customer->update($data);
     return redirect()->route('customer.index');
 }