1<?php
2//Laravel 7 tested
3use App\Models\Eloquent\DriversModel;
4use Illuminate\Database\Seeder;
5
6class DriversSeeder extends Seeder
7{
8 /**
9 * Run the database seeds.
10 *
11 * @return void
12 */
13 public function run()
14 {
15 if (Schema::hasTable("drivers")) {
16 // Nechta generatsiya qilish kerak bo`lsa belgilanadi default 10 tani tashkil qiladi
17 $count = (int)$this->command->ask('Necha dona Ustun qo`shishim kerak?', 10);
18 for ($i=1; $i < $count; $i++) {
19 DriversModel::query()->updateOrCreate(['id' => $i], [
20 'car_number' => ''.$i.'A365EA',
21 'trailer_number' => 'a5s6d4321c2a6',
22 'technical_passport' => 'asd56a5sa6f5',
23 'full_name' => 'Akbarali'.$i.'',
24 'passport' => '{"0": "test'.$i.'.png", "1": "test1'.$i.'.png"}',
25 'license_limitation' => '6567965',
26 'license' => '{"0": "test'.$i.'.png", "1": "test1'.$i.'.png"}',
27 'rate' => '54546'.$i,
28 'user_id' => '3',
29 ]);
30 $this->command->info("{$i} ustun qo'shildi.");
31 }
32 $this->command->info("Jami {$i} ustun qo'shildi.");
33 }
34 }
35}
36
1class UsersTableSeeder extends Seeder
2{
3 public function run()
4 {
5 $limit = env('SEEDER_LIMIT', 1);
6
7 echo $this->limit;
8 }
9}
10
11//In terminal run:
12SEEDER_LIMIT=10 php artisan db:seed --class=UsersTableSeeder
13