12345678910111213141516171819202122232425262728293031 |
- <?php
- use Illuminate\Database\Seeder;
- class NotificationSeeder extends Seeder
- {
- /**
- * Run the database seeds.
- *
- * @return void
- */
- public function run()
- {
- $user = \App\User::first();
- $order = \App\Models\Order::first();
- \App\Models\Notification::truncate();
- $total = 100;
- for($i = 0; $i < $total; ++$i) {
- $type = mt_rand(1, 2);
- $status = $type == 1 ? mt_rand(1, 5) : mt_rand(1, 7);
- $is_read = mt_rand(1, 2);
- \App\Models\Notification::create([
- 'user_id' => $user->id,
- 'order_id' => $order->id,
- 'type' => $type,
- 'status' => $status,
- 'is_read' => $is_read
- ]);
- }
- }
- }
|