public function doCreateAccount(CreateAccountRequest $request)
 {
     $input = $request->all();
     $input['password'] = bcrypt($input['password']);
     User::create($input);
     session()->flash('flash_message', 'Successfully created your account, now you have to login ^^');
     return redirect()->route('admin-login');
 }
Example #2
0
 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(CreateAccountRequest $request, $id)
 {
     $account = Bank_account::find($id);
     if (!$account) {
         return response()->json(['message' => 'This account does not exist', 'code' => 404], 404);
     }
     $fi_id = $request->get('fi_id');
     $account_number = $request->get('account_number');
     $account_type_id = $request->get('account_type_id');
     $account_currency = $request->get('currency_id');
     $account->fi_id = $fi_id;
     $account->account_number = $account_number;
     $account->account_type_id = $account_type_id;
     $account->currency_id = $account_currency;
     //return $account;
     $account->save();
     return response()->json(['message' => 'The account has been updated'], 200);
 }
Example #3
0
 public function store(CreateAccountRequest $request)
 {
     //        $input = Request::all();
     $pharmacy = Pharmacy::create(["name" => $request->get('name'), "address" => $request->get('address'), "city" => $request->get('city'), "state" => $request->get('state'), "zipcode" => $request->get('zipcode'), "npi" => $request->get('npi'), "dea" => $request->get('dea'), "nabp" => $request->get('nabp'), "pic" => $request->get('pic'), "contact" => $request->get('contact'), "contact_person" => $request->get('contact_person'), "email" => $request->get('email'), "billing_address" => $request->get('billing_address'), "billing_city" => $request->get('billing_city'), "billing_state" => $request->get('billing_state'), "billing_zipcode" => $request->get('billing_zipcode'), "mailing_address" => $request->get('mailing_address'), "mailing_city" => $request->get('mailing_city'), "mailing_state" => $request->get('mailing_state'), "mailing_zipcode" => $request->get('mailing_zipcode')]);
     $pharmacists = new Pharmacist(["fname" => $request->get('name'), "mname" => $request->get('name'), "lname" => $request->get('name'), "bdate" => date('Y-m-d'), "email" => $request->get('email'), "contact" => $request->get('contact')]);
     $account = new Account(["username" => $request->get('username'), "password" => $request->get('password'), "rights" => "0"]);
     $pharmacy->pharmacists()->save($pharmacists)->account()->save($account);
     Session::flash('flash_message', 'Registration Successful!');
     return Redirect::guest('/');
 }
 /**
  * Update account
  * @param $accountId
  * @param CreateAccountRequest $request
  *
  * @return Account
  */
 public static function updateAccount($accountId, CreateAccountRequest $request)
 {
     $account = Account::findOrFail($accountId);
     $account->update(array_merge($request->all(), ['user_id' => \Auth::user()->id]));
     return $account;
 }