示例#1
0
 /**
  * Delete user
  *
  * @param  integer $id User ID
  *
  * @return \Illuminate\Support\Facades\Response
  */
 public function destroy($id)
 {
     try {
         $user = User::findOrFail($id);
         $username = $user->username;
         $user->delete();
         return MainHelper::response(['url' => route('admin.site.users.index')], Lang::get('alerts.user.deleted', compact('username')));
     } catch (ModelNotFoundException $e) {
         $this->messages[] = Lang::get('alerts.user.invlid', ['userid' => $id]);
         return Redirect::route('admin.site.users.index')->withErrors($this->messages);
     }
 }
示例#2
0
 /**
  * Attempt to confirm the account with code
  *
  * @param  string $code
  * @return boolean
  */
 public function confirm($code)
 {
     $user = User::where('confirmation_code', $code)->first();
     if (!$user['confirmed']) {
         return Confide::confirm($code);
     }
     return false;
 }