/** * Store a newly created resource in storage. * * @return Response */ public function store() { $this->plot->fill($this->params['plot']); if ($this->plot->save()) { $application = ServiceApplication::create(['FormID' => 3, 'ServiceID' => 1603, 'ServiceStatusID' => 1, 'SubmissionDate' => date('Y-m-d H:i:s'), 'CustomerID' => $this->currentUser->agentAccount->id]); $application->save(); return redirect('/dashboard')->with('message', 'Application Submitted!'); } else { dd('error!'); } }
public function store() { $this->account->fill($this->params['account']); if ($this->account->save()) { # store business account profile $profile = BusinessProfile::create(['code' => $this->params['account']['code'], 'phone' => $this->params['account']['phone'], 'email' => $this->params['account']['email'], 'website' => $this->params['account']['website'], 'address' => $this->params['account']['address'], 'service_id' => $this->params['account']['service_id'], 'department_id' => $this->params['account']['department_id']]); $this->account->businessProfile()->save($profile); $this->account->users()->sync([$this->currentUser->id], false); # submit application for sbp $application = ServiceApplication::create(['FormID' => 2, 'ServiceID' => 303, 'ServiceStatusID' => 1, 'SubmissionDate' => date('Y-m-d H:i:s'), 'CustomerID' => $this->currentUser->agentAccount->id]); $application->save(); return redirect('/dashboard/businesses')->with('message', 'Business Account Added!'); } else { dd('error!'); } }