DatabaseSeeder.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace Database\Seeders;
  3. use App\Models\User;
  4. use App\Models\Course;
  5. // use Illuminate\Database\Console\Seeds\WithoutModelEvents;
  6. use Illuminate\Database\Seeder;
  7. use Illuminate\Support\Facades\Hash;
  8. class DatabaseSeeder extends Seeder
  9. {
  10. /**
  11. * Seed the application's database.
  12. */
  13. public function run(): void
  14. {
  15. User::create([
  16. 'login' => 'Admin',
  17. 'email' => 'admin@example.com',
  18. 'full_name' => 'Администратор',
  19. 'phone' => '8(999)111-11-11',
  20. 'password' => Hash::make('KorokNET'),
  21. ]);
  22. User::create([
  23. 'login' => 'Admin',
  24. 'email' => 'admin@example.com',
  25. 'full_name' => 'Администратор',
  26. 'phone' => '8(999)111-11-11',
  27. 'password' => Hash::make('KorokNET'),
  28. ]);
  29. $courses = [
  30. [
  31. "name" => 'Алгоритмизация',
  32. "description" => 'Алгоритмизация',
  33. "price" => 15000,
  34. ],
  35. [
  36. "name" => 'Базы данных',
  37. "description" => 'Базы данных',
  38. "price" => 15000,
  39. ],
  40. [
  41. "name" => 'дизайн',
  42. "description" => 'дизайн',
  43. "price" => 15000,
  44. ],
  45. ];
  46. foreach ($courses as $course) {
  47. Course::create($course);
  48. }
  49. }
  50. }