simedkom/database/factories/AnnouncementFactory.php
Yoga Pangestu 8386ea0d93 feat(models): add relationships to PartnerMedia and User models
- Introduced a many-to-many relationship in PartnerMedia for announcements.
- Added a has-many relationship in User for news authored by the user.
- Implemented an active scope in User for filtering active users.
2025-12-12 10:06:18 +07:00

47 lines
1.0 KiB
PHP

<?php
namespace Database\Factories;
use App\Models\Announcement;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Announcement>
*/
class AnnouncementFactory extends Factory
{
protected $model = Announcement::class;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'content' => $this->faker->paragraphs(2, true),
];
}
/**
* Indicate that the announcement is important.
*/
public function important(): static
{
return $this->state(fn (array $attributes) => [
'content' => 'PENTING: '.$this->faker->sentence(10),
]);
}
/**
* Indicate that the announcement is informational.
*/
public function informational(): static
{
return $this->state(fn (array $attributes) => [
'content' => 'INFORMASI: '.$this->faker->paragraph(),
]);
}
}