/** * Store a newly created resource in storage. * * @param Request $request * @return Response */ public function store(Request $request) { // $company = new company($request->all()); $company->save(); $user = User::find(Auth::user()->id); $user->company_id = $company->id; $user->update(); return redirect('configuracion'); }
public function addcompany(Requests\companyvalidate $request) { try { $input = $request->all(); $customer = new customer(); $customer->address = Input::get('address'); $customer->email = Input::get('email'); $customer->contact_no = Input::get('telephone_number'); $customer->name = Input::get('comname'); $customer->lane1 = Input::get('lane1'); $customer->lane2 = Input::get('lane2'); $customer->city = Input::get('city'); $customer->save(); $company = new company(); $company->cus_id = $customer->cus_id; $company->save(); $changelog = new changes_log(); $changelog->user = '******'; $changelog->action_type = 'Add Company'; $changelog->description = $customer->name . ' added as a new company'; $changelog->save(); return redirect('/guest_profile/company_list')->with('succ_status', 'Successfully Added'); } catch (Exception $e) { return redirect('/guest_profile/company_list/create')->with(['exception' => 'You cannot add the Company. Please Chack you E-maile and Contact No!']); } }