當前位置: 首頁>>代碼示例>>PHP>>正文


PHP User::all方法代碼示例

本文整理匯總了PHP中User::all方法的典型用法代碼示例。如果您正苦於以下問題:PHP User::all方法的具體用法?PHP User::all怎麽用?PHP User::all使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在User的用法示例。


在下文中一共展示了User::all方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: index

 public static function index()
 {
     self::check_admin_logged_in();
     $name = self::get_search_term();
     $users = User::all($name);
     View::make('user/index.html', array('users' => $users));
 }
開發者ID:eerojala,項目名稱:Hiihtokilpailujen-tulospalvelu,代碼行數:7,代碼來源:user_controller.php

示例2: register

 public function register()
 {
     if (RequestMethods::post('register')) {
         $pass = RequestMethods::post("pass");
         $cpass = RequestMethods::post("cpass");
         $salt = strtr(base64_encode(mcrypt_create_iv(16, MCRYPT_DEV_URANDOM)), '+', '.');
         $cost = 10;
         $salt = sprintf("\$2a\$%02d\$", $cost) . $salt;
         $crypt = crypt($pass, $salt);
         $user = new User(array("full_name" => RequestMethods::post("full_name"), "email" => RequestMethods::post("email"), "password" => $crypt));
         $exist = User::all(array('email = ?' => RequestMethods::post("email")));
         if (empty($exist)) {
             if ($pass == $cpass) {
                 if ($user->validate()) {
                     $user->save();
                     return "success";
                 } else {
                     return "validation not good";
                 }
             } else {
                 return "Passwords do not match";
             }
         } else {
             return "User exists";
         }
     } else {
         header('Location: /');
     }
 }
開發者ID:shreyanshgoel,項目名稱:tours,代碼行數:29,代碼來源:users.php

示例3: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $users = User::all();
     $book_count = Book::all()->count();
     $chapter_count = Chapter::all()->count();
     return View::make('admin.admin_panel', array('pageTitle' => 'Admin Panel', 'users' => $users, 'book_count' => $book_count, 'chapter_count' => $chapter_count));
 }
開發者ID:Belar,項目名稱:librific,代碼行數:12,代碼來源:AdminController.php

示例4: doRegister

 public function doRegister()
 {
     $username = Input::get('username');
     $password = Input::get('password');
     $password = Hash::make($password);
     if ($username != "" && $password != "") {
         $users = User::all();
         $usernames = array();
         foreach ($users as $user) {
             $usernames[] = $user->username;
         }
         if (!in_array($username, $usernames)) {
             $user = new User();
             $user->username = $username;
             $user->password = $password;
             $user->save();
             $userdata = array('username' => Input::get('username'), 'password' => Input::get('password'));
             if (Auth::attempt($userdata)) {
                 $user = Auth::user();
                 return Response::json(array('error' => false, 'userdata' => $user), 200);
             } else {
                 return Response::json(array('error' => true, 'reason' => 'login failed'), 200);
             }
         } else {
             return Response::json(array('error' => true, 'reason' => 'username not unique'), 200);
         }
     } else {
         return Response::json(array('error' => true, 'reason' => 'username or password is empty'), 200);
     }
 }
開發者ID:jbrown25,項目名稱:PhotoSharing-PHP-backend,代碼行數:30,代碼來源:HomeController.php

示例5: init

 public function init($id_tovar)
 {
     $data = $_REQUEST;
     $join = "INNER JOIN koncentrator_tovarishestvo c ON(user.concetrator = c.name_konc)";
     $this->_Users = User::all(array('conditions' => array("is_admin <> ? and id_tovar= ?", 1, $id_tovar), 'joins' => $join));
     $this->id_tovar = $id_tovar;
     /* if (!isset($data[Users::PAGE])) {
               $this->_Users = User::find('all', array('limit' => 2), array('conditions' => "is_admin <> 1"));
               //var_dump($_Users);
               } else {
     
     
               $this->_Users = User::find('all', array('conditions' => "is_admin <> 1", 'limit' => 2, 'offset' => (($data[Users::PAGE] * 2) - 2)));
               //var_dump($_Users);
               } */
     $this->countPage = ceil(User::count(array('conditions' => "is_admin <> 1")) / 2);
     if (isset($data[self::BUTTON_DELETE])) {
         $User = User::find_by_login($data['login']);
         if ($User instanceof User) {
             $User->delete();
             Flight::redirect('/admin/users/' . $this->id_tovar . '?success=3');
         }
     }
     if (isset($data['saveUser'])) {
         if ($data['idUser'] === 'newUser') {
             return $this->addNewUser();
         } else {
             return $this->changeUser();
         }
     }
 }
開發者ID:smilexx,項目名稱:counter,代碼行數:31,代碼來源:Users.php

示例6: write_user_list

 function write_user_list()
 {
     $this->write_block_begin('User list');
     $this->write_form_begin('user_group_add.php', 'get');
     $this->write_form_preserve('redirect');
     echo '<label>Search for users: ';
     $this->write_form_field('text', 'user_filter', @$_REQUEST['user_filter']);
     echo '</label>';
     $this->write_form_end('Show');
     echo '<small>Make sure your lab partner has logged in with Justitia at least once.</small>';
     if (!isset($_REQUEST['user_filter'])) {
         return;
     }
     $filter = '%' . @$_REQUEST['user_filter'] . '%';
     echo '<table class="user-list">' . "\n";
     $users = User::all($filter);
     foreach ($users as $user) {
         echo '<tr>';
         echo '<td>', htmlspecialchars($user->name_and_login()), '</td>';
         if (UserGroup::contains($user)) {
             echo '<td>[already in group]</td>';
         } else {
             echo '<td><a href="user_group_add.php?add=' . $user->userid . '&amp;redirect=' . urlencode($_REQUEST['redirect']) . '">[add to group]</a></td>';
         }
         echo "</tr>\n";
     }
     echo '</table>';
     $this->write_block_end();
 }
開發者ID:jlsa,項目名稱:justitia,代碼行數:29,代碼來源:user_group_add.php

示例7: loginView

 public function loginView()
 {
     $users = User::all();
     if (count($users) == 0) {
         $token = Utilities::generateTokenForm();
         $action = $this->app->urlFor('add_admin');
         $vars = array();
         if (isset($_SESSION['vars'])) {
             $vars = $_SESSION['vars'];
             unset($_SESSION['vars']);
         }
         $this->view = new NewAdmin($action, $token['token'], $vars);
         $this->view->display();
     } else {
         $action = $this->app->urlFor('login_post');
         $token = Utilities::generateTokenForm();
         $vars = array();
         if (isset($_SESSION['vars'])) {
             $vars = $_SESSION['vars'];
             unset($_SESSION['vars']);
         }
         $this->view = new LoginView($action, $token['token'], $vars);
         $this->view->display();
     }
 }
開發者ID:alsvader,項目名稱:percasBlog,代碼行數:25,代碼來源:UserController.class.php

示例8: get_add

 public function get_add()
 {
     $this->data['pools'] = Koki::to_dropdown(Pool::all(), 'id', 'pool_name', array(0 => 'All'));
     $this->data['users'] = Koki::to_dropdown(User::all(), 'id', 'first_name');
     $this->data['create'] = true;
     return View::make('themes.modul.' . $this->views . '.form', $this->data);
 }
開發者ID:acmadi,項目名稱:diantaksi,代碼行數:7,代碼來源:news.php

示例9: run

 public function run()
 {
     $users = User::all();
     for ($i = 0, $length = count($users); $i < $length; $i++) {
         BusinessUser::create(['user_id' => $users[$i]->user_id, "business_name" => "企業名稱_" . ($i + 1), "business_licence_no" => "1111111111111111" . ($i + 1), "business_licence_scan_path" => "http://7sbxao.com1.z0.glb.clouddn.com/avatar.jpg", "operational_name" => "logan", "operational_card_no" => "480023196807150234" . ($i + 1), "operational_phone" => "15902345624" . ($i + 1), "bank_account" => "315247183127" . ($i + 1), "deposit_bank" => "工商銀行", "bank_outlets" => "大韓民國宇宙中心支行", "id_card_front_scan_path" => "http://7sbxao.com1.z0.glb.clouddn.com/avatar.jpg", "id_card_back_scan_path" => "http://7sbxao.com1.z0.glb.clouddn.com/avatar.jpg"]);
     }
 }
開發者ID:Jv-Juven,項目名稱:carService,代碼行數:7,代碼來源:BusinessUsersTableSeeder.php

示例10: createFakerAd

 protected function createFakerAd()
 {
     $faker = Faker::create();
     $adtype = array("Informal Jam", "Formal Jam/Practice/Rehearsal", "Payed Gig", "Offering Lessons", "Wanting Lessons");
     $level = array("Beginner", "Intermediate", "Semi-Pro", "Professional");
     $original = array("Originals", "Covers", "Both");
     $venuetype = array("House", "Venue", "Recording Studio", "Event");
     $usertype = array("Band", "Musician");
     $genre = array("Acoustic Blues", "Electric Blues", "Bluegrass", "Classical", "Pop Country", "Traditional Country", "House", "Deep House", "Dubstep", "Trap", "Techno", "Downtempo", "Ambient", "Drums & Bass", "Video Game", "Americana", "Acoustic Folk", "Cajun Folk", "Celtic Folk", "Singer/Songwriter Folk", "Combo Jazz", "Dixieland Jazz", "Ensemble Jazz", "Fusion Jazz", "Latin Jazz", "Standards", "Acid Jazz", "Latin", "New Age", "Ambient", "Christian", "Classic Rock", "Dance", "Hard Rock", "Heavy Metal", "Indie Rock", "Latin Rock", "New Wave", "Pop", "Psychedelic", "Punk Rock", "Rock & Roll", "Rockabilly", "Singer/Songwriter", "Ska", "Soft Rock", "Southern Rock", "Top 40", "Hip Hop/Rap", "Classic Soul", "Neo-Soul", "Gospel", "Contemporary R&B", "Reggae", "Soundtrack", "World Music");
     $instrument = array("Full Band, Acoustic Guitar", "Classical Guitar", "Electric Guitar", "Steel Guitar", "Electric Bass", "Double Bass", "Ukelele", "Piano", "Keyboard", "Organ", "Accordion", "Drums", "Lead Rock/Pop Vocals", "Lead Jazz Vocals", "Bass Singer", "Baritone Singer", "Tenor Singer", "Alto Singer", "Mezzo-Soprano Singer", "Soprano Singer", "Cello", "Viola", "Violin", "Fiddle", "Banjo", "Harp", "Mandolin", "Trumpet", "Trombone", "Tuba", "French Horn", "Alto Sax", "Tenor Sax", "Flute", "Oboe", "Clarinet", "Harmonica", "Piccolo", "Bassoon");
     $equipment = array("P/A System", "Guitar Amp", "Bass Amp", "Drum Set", "Keyboard");
     for ($i = 1; $i <= 200; $i++) {
         $ad = new Ad();
         $ad->ad_type = $faker->randomElement($adtype);
         $ad->ad_need = implode(", ", $faker->randomElements($instrument, $count = rand(1, 3)));
         $ad->ad_title = $faker->state . " " . $faker->lastName;
         $ad->level = $faker->randomElement($level);
         $ad->comp = rand(0, 200);
         $ad->genre = implode(", ", $faker->randomElements($genre, $count = rand(1, 3)));
         $ad->date = $faker->dateTimeBetween($startDate = 'now', $endDate = '3 months');
         $ad->start_time = $faker->time($format = 'H:i:s', $min = 'now');
         $ad->description = $faker->realText;
         $ad->equipment = implode(", ", $faker->randomElements($equipment, $count = rand(0, 5)));
         $ad->venue_type = $faker->randomElement($venuetype);
         $ad->venue = "Tycoon Flats";
         $ad->address = "2926 N. St. Marys Street";
         $ad->city = "San Antonio";
         $ad->state = "TX";
         $ad->zip_code = "78212";
         $ad->user_id = User::all()->random(1)->id;
         $ad->ad_img = $faker->imageUrl($width = 640, $height = 480, $category = 'nightlife');
         $ad->save();
     }
 }
開發者ID:jamalots,項目名稱:jamalot.dev,代碼行數:34,代碼來源:AdsTableSeeder.php

示例11: index

 /**
  * Index Page for this controller.
  *
  * Maps to the following URL
  * 		http://example.com/index.php/welcome
  *	- or -
  * 		http://example.com/index.php/welcome/index
  *	- or -
  * Since this controller is set as the default controller in
  * config/routes.php, it's displayed at http://example.com/
  *
  * So any other public methods not prefixed with an underscore will
  * map to /index.php/welcome/<method_name>
  * @see http://codeigniter.com/user_guide/general/urls.html
  */
 public function index()
 {
     $this->load->model('User');
     $foos['results'] = User::all();
     $data['name'] = 'Mehdi';
     $this->twig->render('hello', $data);
 }
開發者ID:nmedelmehdi,項目名稱:socle,代碼行數:22,代碼來源:Info.php

示例12: staff

 public function staff($app)
 {
     $app->output->addBreadcrumb('', 'CSGOShop');
     $app->output->addBreadcrumb('about/staff', 'Staff Team');
     $app->output->setTitle('Staff Team');
     $app->output->setActiveTab('about');
     $staff = User::all(['conditions' => ['rank >= ?', User::RANK_MODERATOR], 'order' => 'rank DESC']);
     $steamIDs = [];
     foreach ($staff as $user) {
         if ($user->requiresSync()) {
             $steamIDs[] = $user->id;
         }
     }
     if (count($steamIDs) > 0) {
         $data = $app->steam->getUser($steamIDs);
         foreach ($staff as $user) {
             if ($user->requiresSync()) {
                 $user->name = $data[$user->id]->personaname;
                 $user->avatar_url = $data[$user->id]->avatarfull;
                 $user->steam_status = $data[$user->id]->personastate > 0 ? 1 : 0;
                 $user->last_sync = time() + 600;
                 $user->save();
             }
         }
     }
     $app->output->render('about.staff', ['staff' => $staff]);
 }
開發者ID:puttyplayer,項目名稱:CSGOShop,代碼行數:27,代碼來源:AboutController.php

示例13: setupDatabases

 public function setupDatabases()
 {
     $name = $this->call('migrate', array('--path' => 'app/database/migrations/setup/'));
     $name = $this->call('migrate');
     // create the roles
     $roles = ['Admin', 'Writer', 'Reader'];
     foreach ($roles as $r) {
         $role = Role::whereName($r)->first();
         if ($role == null) {
             $role = new Role();
             $role->name = $r;
             $role->display_name = $r;
             $role->save();
             $this->info("{$role->id} Creating Role:{$r}");
         }
     }
     foreach (User::all() as $u) {
         $this->info("{$u->id} : user: {$u->username}");
     }
     // add core assets
     $m = Asset::findFromTag('missing-user-image');
     if ($m == NULL) {
         $m = new Asset();
         $m->path = "assets/content/uploads";
         $m->saveLocalFile(public_path('assets/content/common/missing/profile-default.png'), 'profile-default.png');
         $m->tag = 'missing-user-image';
         $m->shared = 1;
         $m->type = Asset::ASSET_TYPE_IMAGE;
         $m->save();
     }
     $this->comment("****\tAll Databases for Halp have been setup :-) \t****");
     return;
 }
開發者ID:vanderlin,項目名稱:halp,代碼行數:33,代碼來源:CreateDatabases.php

示例14: index

 public function index()
 {
     if (!(Auth::check() && Auth::user()->canManageUsers())) {
         return Redirect::to('/');
     }
     return View::make('users.index', array('css' => 'users', 'users' => User::all()));
 }
開發者ID:SanderVerkuil,項目名稱:molenpark,代碼行數:7,代碼來源:UsersController.php

示例15: getUsers

 public function getUsers()
 {
     if (empty($this->users)) {
         $this->users = User::all();
     }
     return $this->users;
 }
開發者ID:mermetbt,項目名稱:biome,代碼行數:7,代碼來源:UsersCollection.php


注:本文中的User::all方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。