1 Jawaban
13 Dilihat
1 tahun yang lalu
Call to a member function randomNumber() on int

  at D:\Edowork\colone\eduwork-laravel-vue\library\database\seeders\BookSeeder.php:22
     18▕     {
     19▕         $faker = Faker::create();
     20▕         for ($i = 0; $i < 50; $i++) {
     21▕             $book = new Book;
  ➜  22▕             $book->isbn = $faker->randomNumber(9);
     23▕             $book->title = $faker->title;
     24▕             $book->year = $faker = rand(2010, 2023);
     25▕ 
     26▕             $book->publisher_id = rand(1, 20);

  1   D:\Edowork\colone\eduwork-laravel-vue\library\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:36
      Database\Seeders\BookSeeder::run()

  2   D:\Edowork\colone\eduwork-laravel-vue\library\vendor\laravel\framework\src\Illuminate\Container\Util.php:40     
      Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
PS D:\Edowork\colone\eduwork-laravel-vue\library>
Laravel x Vue js db seed
1 Jawaban
Sort
Jawaban Terbaik

bagian ini
$book->year = $faker = rand(2010, 2023);

bisa diganti jadi 
$book->year = rand(2010,2023);

1
avatar
Prof. Reza
1 tahun yang lalu
Newest Question