예제 #1
0
 /**
  * Update the specified resource in storage.
  *
  * @param AccountFormRequest $accountForm FormRequest
  * @param Account            $account     Account
  *
  * @return \Illuminate\Http\Response
  */
 public function update(AccountFormRequest $accountForm, Account $account)
 {
     $accountData = $accountForm->all();
     // may we edit this account
     if (!$account->mayEdit($this->auth_user)) {
         return Redirect::back()->with('message', 'User is not authorized to edit this account.');
     }
     // massage data
     if (gettype($accountData['disabled']) == 'string') {
         $accountData['disabled'] = $accountData['disabled'] == 'true';
     }
     // may we disable the account, when requested
     if ($account->isSystemAccount() && $accountData['disabled']) {
         return Redirect::back()->with('message', "System account can't be disabled.");
     }
     $account->update($accountData);
     return Redirect::route('admin.accounts.show', $account->id)->with('message', 'Account has been updated.');
 }
예제 #2
0
 /**
  * Update the specified resource in storage.
  *
  * @param  AccountFormRequest $accountForm FormRequest
  * @param  Account            $account Account
  * @return \Illuminate\Http\Response
  */
 public function update(AccountFormRequest $accountForm, Account $account)
 {
     // may we edit this brand (is the brand connected to our account)
     if (!$account->mayEdit($this->auth_user)) {
         return Redirect::route('admin.accounts.show', $account->id)->with('message', 'User is not authorized to edit this account.');
     }
     $account->update($accountForm->all());
     return Redirect::route('admin.accounts.show', $account->id)->with('message', 'Account has been updated.');
 }