| 123456789101112131415161718192021222324252627282930313233343536373839 |
- <?php
- use Illuminate\Database\Seeder;
- use Faker\Factory;
- use App\Models\Mysql\AppModel;
- use App\Repositories\AppRepository;
- class AppSeeder extends Seeder
- {
- /**
- * Seed the application's database.
- *
- * @return void
- */
- public function run()
- {
- /**
- * @var $repo AppRepository
- */
- $repo = app(AppRepository::class);
- $faker = Factory::create('en_US');
- $maxNum = 2;
- for ($i = 0; $i < $maxNum; $i++) {
- $name = $faker->name();
- $iconUrl = $faker->imageUrl(144, 144, 'animals', true);
- $apiUrl = '';
- $apiParam = 'token';
- $apiKey = 'wg888888';
- $status = rand(1, 2);
- $setarr = [
- 'name' => $name,
- 'icon_url' => $iconUrl,
- ];
- $repo->createOne($setarr);
- }
- $this->command->comment('App应用创建完毕, '. $i . '个',);
- }
- }
|