Beispiel #1
0
 public function index()
 {
     $data['system_manager'] = true;
     $email = $this->request->get('email');
     $pagination = new Paginator($this->request->get('page'), 20, $this->request->data());
     $query = DB::table('users as u')->select("u.*,ug.group_name")->leftJoin('usergroups as ug', 'u.group_id=ug.group_id')->limit($pagination->getLimit(), $pagination->getOffset());
     if (Str::isEmail($email)) {
         $query->where('email', $email);
     }
     $data['users'] = $query->get(\PDO::FETCH_OBJ);
     $data['pagination'] = $pagination->makeHtml(5);
     return View::make('admin/system/user-index', $data);
 }
Beispiel #2
0
 public function edit($id)
 {
     if (!$id) {
         return Redirect::action('system/group')->with('error', '用户组不存在');
     }
     $group = DB::table('usergroups')->where('group_id', $id)->first();
     if (empty($group)) {
         return Redirect::action('system/group')->with('error', '用户组不存在');
     }
     $view = View::make('admin/system/group-edit');
     $view->system_manager = true;
     $view->group = $group;
     $view->token = Security::getToken($id);
     $view->id = $id;
     return $view;
 }
Beispiel #3
0
 public static function findByEmail($email)
 {
     return DB::table('users')->where('email', $email)->first(\PDO::FETCH_OBJ);
 }