当前位置: 首页>>代码示例>>PHP>>正文


PHP User::lists方法代码示例

本文整理汇总了PHP中app\models\User::lists方法的典型用法代码示例。如果您正苦于以下问题:PHP User::lists方法的具体用法?PHP User::lists怎么用?PHP User::lists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\User的用法示例。


在下文中一共展示了User::lists方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: edit

 public function edit(Player $player)
 {
     $users = ['' => ''] + User::lists('name', 'id')->all();
     $teams = Team::lists('name', 'id');
     $statuses = Player::$statuses;
     return view('backend.players.edit')->with('player', $player)->with('users', $users)->with('teams', $teams)->with('statuses', $statuses);
 }
开发者ID:AlexYaroma,项目名称:mightyducks,代码行数:7,代码来源:PlayersController.php

示例2: run

 public function run()
 {
     Question::truncate();
     $faker = Faker\Factory::create();
     $authorIds = User::lists('id');
     for ($i = 0; $i < 10; $i++) {
         Question::create(['desc' => $faker->sentence, 'type' => $faker->word, 'status' => $faker->randomElement(array(0, 1)), 'author_id' => $faker->randomElement($authorIds)]);
     }
 }
开发者ID:ShuvarthiDhar,项目名称:tobacco,代码行数:9,代码来源:QuestionTableSeeder.php

示例3: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     $topics = c2a(Topic::lists('id'));
     $users = c2a(User::lists('id'));
     foreach (range(1, 100) as $index) {
         Reply::create(['topic_id' => $faker->randomElement($topics), 'user_id' => $faker->randomElement($users), 'content' => $faker->sentence(100)]);
     }
 }
开发者ID:jiketao,项目名称:jiketao-laravel,代码行数:14,代码来源:RepliesTableSeeder.php

示例4: run

 public function run()
 {
     News::truncate();
     $faker = Faker\Factory::create();
     $authorIds = User::lists('id');
     for ($i = 0; $i < 10; $i++) {
         News::create(['title' => $faker->word, 'desc' => $faker->sentence, 'image_url' => $faker->imageUrl($width = 640, $height = 480), 'share_url' => $faker->url, 'status' => $faker->randomElement(array(0, 1)), 'author_id' => $faker->randomElement($authorIds)]);
     }
 }
开发者ID:ShuvarthiDhar,项目名称:tobacco,代码行数:9,代码来源:NewsTableSeeder.php

示例5: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     $products = c2a(Product::lists('id'));
     $users = c2a(User::lists('id'));
     foreach (range(1, 20) as $index) {
         Topic::create(['title' => $faker->sentence(6), 'slug' => $faker->name, 'product_id' => $faker->randomElement($products), 'user_id' => $faker->randomElement($users), 'keywords' => $faker->sentence, 'description' => $faker->sentence(10), 'content' => $faker->sentence(100), 'page_view_count' => rand(10, 3059), 'vote_count' => rand(0, 199), 'reply_count' => rand(0, 100)]);
     }
 }
开发者ID:jiketao,项目名称:jiketao-laravel,代码行数:14,代码来源:TopicsTableSeeder.php

示例6: run

 public function run()
 {
     Comment::truncate();
     $faker = Faker\Factory::create();
     $userIds = User::lists('id');
     $postIds = Post::lists('id');
     for ($i = 0; $i < 10; $i++) {
         Comment::create(['desc' => $faker->sentence, 'user_id' => $faker->randomElement($userIds), 'post_id' => $faker->randomElement($postIds), 'status' => $faker->randomElement(array(0, 1))]);
     }
 }
开发者ID:ShuvarthiDhar,项目名称:tobacco,代码行数:10,代码来源:CommentTableSeeder.php

示例7: run

 public function run()
 {
     $faker = Faker::create();
     $users = App\Models\User::all()->lists('id')->toArray();
     $userIds = App\Models\User::lists('id');
     foreach (range(1, 20) as $index) {
         $firstname = $faker->firstname;
         $lastname = $faker->lastname;
         $username = str_replace('.', '_', $faker->unique()->userName);
         $profile = Profile::create(['user_id' => $faker->randomElement($userIds), 'confirmed' => $faker->boolean($chanceOfGettingTrue = 50), 'is_active' => $faker->boolean($chanceOfGettingTrue = 50), 'is_fake' => true, 'activated' => $faker->boolean($chanceOfGettingTrue = 50), 'published' => $faker->boolean($chanceOfGettingTrue = 50), 'is_active' => $faker->boolean($chanceOfGettingTrue = 50), 'is_employee' => $faker->boolean($chanceOfGettingTrue = 50), 'is_public' => $faker->boolean($chanceOfGettingTrue = 50), 'website' => $faker->domainName, 'company' => $faker->company, 'uuid' => $faker->uuid, 'facebook_username' => $username . '_facebook', 'twitter_username' => $username . '_twitter', 'instagram_username' => $username . '_instagram', 'githubid' => $username . '_github', 'skypeid' => $username . '_skype', 'linkedinurl' => 'http://www.linkedin.com', 'googleplusurl' => 'http://plus.google.com', 'facebookurl' => 'http://www.facebook.com', 'birth_date' => $faker->date($format = 'm-d-Y', $max = 'now'), 'dob_month' => $faker->numberBetween($min = 1, $max = 12), 'dob_day' => $faker->numberBetween($min = 1, $max = 30), 'dob_year' => $faker->numberBetween($min = 1980, $max = 2010), 'pic' => $faker->imageUrl(600, 600, 'people', true, 'Faker'), 'username' => $username, 'display_name' => $firstname . " " . $lastname, 'about_me' => $faker->paragraph($nbSentences = 3), 'phone' => $faker->phoneNumber, 'phone_type' => 'Home', 'position' => 'employee', 'supervisor' => 'jaren', 'employment_title' => 'random employee', 'employment_role' => 'to follow nathan around the office', 'employment_status' => 'active', 'gender' => $faker->randomElement($array = ['Male', 'Female']), 'note' => $faker->bs, 'user_api_key' => str_random(32), 'user_api_secret' => str_random(64), 'user_activation_key' => str_random(128), 'activation_code_id' => str_random(128), 'activation_code' => str_random(15), 'confirmation_code' => str_random(4), 'profile_activated_on' => $faker->dateTimeBetween($startDate = '-2 years', $endDate = 'now'), 'published_on' => $faker->dateTimeBetween($startDate = '-2 years', $endDate = 'now'), 'slug' => $faker->slug, 'created_at' => Carbon\Carbon::now(), 'updated_at' => Carbon\Carbon::now()]);
     }
 }
开发者ID:phillipmadsen,项目名称:db_grace,代码行数:12,代码来源:ProfilesTableSeeder.php

示例8: getSummaryUserStatistics

 /**
  * Get the summary user statistics
  *
  * @return db resultset
  */
 public static function getSummaryUserStatistics($from, $to, $userID = 0)
 {
     $params = array($from, $to, $from, $to, $from, $to, $from, $to, $from, $to);
     $users = array();
     $data = array();
     if ($userID == 0) {
         $users = User::lists('id');
     } else {
         $users[] = $userID;
     }
     foreach ($users as $user) {
         $userData = DB::select("SELECT u.name, u.designation, \n\t\t\t\t\t\tcount(DISTINCT IF(u.id=t.created_by AND (t.time_created BETWEEN ? AND ?),t.id,NULL)) AS created, \n\t\t\t\t\t\tcount(DISTINCT IF(u.id=t.tested_by AND (t.time_completed BETWEEN ? AND ?),t.id,NULL)) AS tested, \n\t\t\t\t\t\tcount(DISTINCT IF(u.id=t.verified_by AND (t.time_verified BETWEEN ? AND ?),t.id,NULL)) AS verified, \n\t\t\t\t\t\tcount(DISTINCT IF(u.id=s.accepted_by AND (s.time_accepted BETWEEN ? AND ?),t.id,NULL)) AS specimen_registered, \n\t\t\t\t\t\tcount(DISTINCT IF(u.id=s.rejected_by AND (s.time_rejected BETWEEN ? AND ?),t.id,NULL)) AS specimen_rejected \n\t\t\t\t\tFROM tests AS t \n\t\t\t\t\t\tLEFT JOIN specimens AS s ON t.specimen_id = s.id \n\t\t\t\t\t\tLEFT JOIN visits AS v ON t.visit_id = v.id \n\t\t\t\t\t\tINNER JOIN patients AS p ON v.patient_id = p.id \n\t\t\t\t\t\tCROSS JOIN users AS u \n\t\t\t\t\t\tWHERE u.id = {$user}\n\t\t\t\t\t\tGROUP BY u.id\n\t\t\t\t\t\tORDER BY u.name", $params);
         $data = array_merge($data, $userData);
     }
     return $data;
 }
开发者ID:echiteri,项目名称:iBLIS,代码行数:21,代码来源:User.php

示例9: create

 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create()
 {
     $users = User::lists('first_name', 'first_name');
     return view('visitors.create', compact('users'));
 }
开发者ID:suchayj,项目名称:easymanage,代码行数:10,代码来源:VisitorController.php

示例10: function

| Here you may define all of your model factories. Model factories give
| you a convenient way to create models for testing and seeding your
| database. Just tell the factory how a default model should look.
|
*/
use App\Models\User;
use App\Models\Source;
use App\Models\Map;
$factory->define(App\Models\User::class, function (Faker\Generator $faker) {
    return ['name' => $faker->name, 'email' => $faker->email, 'password' => bcrypt(str_random(10)), 'api_token' => str_random(60), 'remember_token' => str_random(10)];
});
$factory->define(App\Models\Setting::class, function (Faker\Generator $faker) {
    return ['group' => $faker->randomElement(['general', 'mapbox', 'preferences']), 'key' => $faker->word, 'value' => $faker->sentence];
});
$factory->define(App\Models\Map::class, function (Faker\Generator $faker) {
    $users = User::lists('id')->toArray();
    $hash = "";
    do {
        $hash = str_random(4);
    } while (Map::where("hash", "=", $hash)->first() instanceof Map);
    return ['hash' => $hash, 'user_id' => $faker->randomElement($users), 'active' => $faker->boolean(75), 'visibility' => $faker->randomElement(['public', 'public', 'public', 'shared', 'shared', 'private']), 'name' => $faker->sentence(6), 'description' => $faker->paragraph(2), 'style' => $faker->randomElement(['cilv7wj9m00uxbim8zml4zdz3', 'cikedqlyp00bbkqlxe7kzopov']), 'longitude' => 4.390819, 'latitude' => 51.92696, 'zoom' => $faker->numberBetween(8, 10), 'pitch' => $faker->numberBetween(10, 50), 'bearing' => $faker->numberBetween(20, 180), 'views' => $faker->numberBetween(1, 1000), 'created_at' => $faker->dateTimeBetween('-2 year', '-6 months'), 'updated_at' => $faker->dateTimeBetween('-5 months', 'now')];
});
$factory->define(App\Models\Source::class, function (Faker\Generator $faker) {
    $hash = "";
    do {
        $hash = str_random(4);
    } while (Source::where("hash", "=", $hash)->first() instanceof Source);
    return ['hash' => $hash, 'origin_type' => $faker->randomElement(['url', 'url', 'url', 'url', 'file', 'dropbox', 'gdrive']), 'origin_url' => $faker->randomElement([null, $faker->url]), 'origin_file' => $faker->randomElement([null, 'whatever.csv']), 'origin_format' => $faker->randomElement(['csv', 'geojson']), 'origin_size' => $faker->numberBetween(100000, 15000000), 'name' => $faker->sentence(2), 'description' => $faker->sentence(20), 'web' => 'https://schiedam.dataplatform.nl/dataset/' . $faker->slug, 'sync_status' => $faker->randomElement(['ready', 'ready', 'ready', 'ready', 'ready', 'queued', 'downloading', 'processing', 'disabled', 'disabled', 'error']), 'sync_interval' => $faker->randomElement(['never', 'onchange', 'hourly', 'daily', 'weekly', 'monthly', 'yearly']), 'synced_at' => $faker->dateTimeBetween('-1 month', '-1 day'), 'created_at' => $faker->dateTimeBetween('-2 year', '-6 months'), 'updated_at' => $faker->dateTimeBetween('-5 months', 'now')];
});
$factory->define(App\Models\Tag::class, function (Faker\Generator $faker) {
    return ['name' => $faker->word];
开发者ID:jaumesala,项目名称:opendata-maps,代码行数:31,代码来源:ModelFactory.php

示例11: edit

 /**
  * Show the form for editing the specified Tracking.
  *
  * @param  int $id
  *
  * @return Response
  */
 public function edit($id)
 {
     $tracking = $this->trackingRepository->findWithoutFail($id);
     $facings = Facing::lists('name', 'id');
     $products = Product::lists('name', 'id');
     $brands = Brand::lists('name', 'id');
     $users = User::lists('name', 'id');
     if (empty($tracking)) {
         Flash::error('Tracking not found');
         return redirect(route('trackings.index'));
     }
     return view('trackings.edit')->with('tracking', $tracking)->with('facings', $facings)->with('products', $products)->with('brands', $brands)->with('users', $users);
 }
开发者ID:sagaciresearch,项目名称:adtracking,代码行数:20,代码来源:TrackingController.php


注:本文中的app\models\User::lists方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。