LoansSeeder.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. namespace Database\Seeders;
  3. use Illuminate\Database\Seeder;
  4. use App\Models\Loan;
  5. use Carbon\Carbon;
  6. class LoansSeeder extends Seeder
  7. {
  8. /**
  9. * Run the database seeds.
  10. *
  11. * @return void
  12. */
  13. public function run() {
  14. Loan::create([
  15. 'user_id' => 2,
  16. 'book_id' => 1,
  17. 'start' => Carbon::now()->format('Y-m-d'),
  18. 'end' => Carbon::now()->format('Y-m-d')
  19. ]);
  20. Loan::create([
  21. 'user_id' => 3,
  22. 'book_id' => 2,
  23. 'start' => Carbon::now()->format('Y-m-d'),
  24. 'end' => null
  25. ]);
  26. Loan::create([
  27. 'user_id' => 4,
  28. 'book_id' => 3,
  29. 'start' => Carbon::now()->format('Y-m-d'),
  30. 'end' => Carbon::now()->format('Y-m-d')
  31. ]);
  32. Loan::create([
  33. 'user_id' => 4,
  34. 'book_id' => 4,
  35. 'start' => Carbon::now()->format('Y-m-d'),
  36. 'end' => Carbon::now()->format('Y-m-d')
  37. ]);
  38. Loan::create([
  39. 'user_id' => 5,
  40. 'book_id' => 5,
  41. 'start' => Carbon::now()->format('Y-m-d'),
  42. 'end' => null
  43. ]);
  44. Loan::create([
  45. 'user_id' => 5,
  46. 'book_id' => 6,
  47. 'start' => Carbon::now()->format('Y-m-d'),
  48. 'end' => Carbon::now()->format('Y-m-d')
  49. ]);
  50. }
  51. }