public function store(Request $request) { $delight = Delight::create(['account_id' => Auth::user()->account_id, 'user_id' => Auth::user()->id, 'customer_id' => $request->customer_id, 'message' => $request->message]); $account = Account::find(Auth::user()->account_id); $account->delights--; $account->save(); return redirect('/dashboard/delights/' . $delight->id); }
/** * Create a new user instance after a valid registration. * * @param array $data * @return User */ protected function create(array $data) { $account = Account::create(['name' => $data['account_name'], 'acquisition_channel' => $data['acquisition_channel']]); return User::create(['first_name' => $data['first_name'], 'last_name' => $data['last_name'], 'account_id' => $account->id, 'email' => $data['email'], 'password' => bcrypt($data['password'])]); }