28 lines
621 B
PHP
28 lines
621 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Album;
|
|
use App\Models\Category;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Album>
|
|
*/
|
|
class AlbumFactory extends Factory
|
|
{
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'name' => fake()->sentence(2),
|
|
'cover' => './covers/image-'.rand(1,12).'-big.jpg',
|
|
'category_id' => Category::all()->random(1)->first()->id,
|
|
];
|
|
}
|
|
}
|