/** * Store a newly created resource in storage. * * @return Response */ public function store(CustomerRequest $request) { $customer = new Customer($request->all()); $customer->code = $customer->name; $customer->save(); Session::flash('success', 'Se agregó correctamente'); return redirect()->route('admin.customers.edit', $customer->id); }
public function addPhone(Request $request) { $employee = $this->employeeRepository->findOrFail($request->get('employee_id')); $employeePhone = $this->employeeRepository->addPhone($employee, $request->get('phone')); $success = false; if (count($employeePhone)) { $success = true; } if ($request->ajax()) { return response()->json(compact('success', 'employeePhone')); } $customers = Customer::get(); Session::flash('success', 'Se agregó correctamente'); return redirect()->route('admin.employees.edit', compact('employee', 'customers')); }