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


PHP User::all方法代码示例

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


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

示例1: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     factory(Address::class, User::all()->count() * ADDRESS_SEED_MULTI)->create();
 }
开发者ID:larryu,项目名称:properta,代码行数:9,代码来源:DatabaseSeeder.php

示例2: function

$factory->define(Rental::class, function (Faker\Generator $faker) {
    $array = ['property_id' => $faker->randomElement(Property::all()->all())->id, 'dailyAmount' => $faker->randomFloat(4, 500 / 30, 2000 / 30), 'from' => random_int(0, 1) === 0 ? null : $faker->dateTimeBetween('-10 years'), 'to' => random_int(0, 1) === 0 ? null : $faker->dateTimeBetween('now', '+10 years'), 'media_ids' => []];
    for ($i = 0; $i < random_int(1, 10); $i++) {
        $array['media_ids'][] = $faker->randomElement(Media::all()->all())->id;
    }
    $array['media_ids'] = json_encode($array['media_ids']);
    return $array;
});
$factory->define(AdminAccess::class, function (Faker\Generator $faker) {
    do {
        $array = ['rental_id' => $faker->randomElement(Rental::all()->all())->id, 'role_id' => $faker->randomElement(Role::all()->all())->id, 'canManage' => $faker->boolean(), 'canManage' => $faker->boolean(), 'canIssue' => $faker->boolean(), 'canDocument' => $faker->boolean(), 'canStatement' => $faker->boolean(), 'canMessage' => $faker->boolean()];
    } while (AdminAccess::where(['rental_id' => $array['rental_id'], 'role_id' => $array['role_id']])->get()->count() > 0);
    return $array;
});
$factory->define(Issue::class, function (Faker\Generator $faker) {
    return ['requester_user_id' => $faker->randomElement(User::all()->all())->id, 'rental_id' => $faker->randomElement(Rental::all()->all())->id, 'status' => $faker->words(random_int(1, 2), true)];
});
$factory->define(IssueDetail::class, function (Faker\Generator $faker) {
    $array = ['issue_id' => $faker->randomElement(Issue::all()->all())->id, 'content' => $faker->sentences(random_int(1, 200), true), 'type' => $faker->words(random_int(1, 2), true), '3rdParty' => $faker->url, 'priority' => $faker->numberBetween(0, 5), 'media_ids' => []];
    for ($i = 0; $i < random_int(1, 10); $i++) {
        $array['media_ids'][] = $faker->randomElement(Media::all()->all())->id;
    }
    $array['media_ids'] = json_encode($array['media_ids']);
    return $array;
});
$factory->define(IssueProgress::class, function (Faker\Generator $faker) {
    return ['issue_id' => $faker->randomElement(Issue::all()->all())->id, 'content' => $faker->sentences(random_int(1, 200), true)];
});
$factory->define(RentalUser::class, function (Faker\Generator $faker) {
    return ['user_id' => $faker->randomElement(User::all()->all())->id, 'role_id' => $faker->randomElement(Role::all()->all())->id, 'rental_id' => $faker->randomElement(Rental::all()->all())->id];
});
开发者ID:larryu,项目名称:properta,代码行数:31,代码来源:ModelFactory.php


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