. */ /* |-------------------------------------------------------------------------- | Model Factories |-------------------------------------------------------------------------- | | This directory should contain each of the model factory definitions for | your application. Factories provide a convenient way to generate new | model instances for testing / seeding your application's database. | */ namespace Database\Factories; use App\Models\User; use Illuminate\Database\Eloquent\Factories\Factory; class TrackFactory extends Factory { /** * The name of the factory's corresponding model. * * @var string */ protected $model = \App\Models\Track::class; /** * Define the model's default state. * * @return array */ public function definition() { $user = User::factory()->create(); return [ 'user_id' => $user->id, 'hash' => $this->faker->md5, 'title' => $this->faker->sentence(5), 'slug' => $this->faker->slug, 'track_type_id' => \App\Models\TrackType::UNCLASSIFIED_TRACK, 'track_number' => null, 'description' => $this->faker->paragraph(5), 'lyrics' => $this->faker->paragraph(5), 'is_vocal' => true, 'is_explicit' => false, 'is_downloadable' => true, 'is_listed' => true, 'metadata' => '{"this":{"is":["very","random","metadata"]}}', 'duration' => $this->faker->randomFloat(null, 30, 600), ]; } }