Created
May 26, 2023 10:25
-
-
Save filipfilipovich/57bb4122fd062c3b53fad077fe3e1410 to your computer and use it in GitHub Desktop.
BookFactory class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Database\Factories; | |
use App\Models\Book; | |
use Illuminate\Database\Eloquent\Factories\Factory; | |
/** | |
* @extends Factory<Book> | |
*/ | |
class BookFactory extends Factory | |
{ | |
/** | |
* Define the model's default state. | |
* | |
* @return array<string, mixed> | |
*/ | |
public function definition(): array | |
{ | |
return [ | |
'title' => ucwords($this->faker->words($this->faker->numberBetween(1, 5), true)), | |
'author' => $this->faker->name(), | |
'isbn' => $this->faker->isbn13(), | |
'number_sold' => $this->faker->numberBetween(100, 1000000), | |
'date_published' => $this->faker->dateTime(), | |
]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment