feat: remove all database factories

This commit is contained in:
Yoga Pangestu 2026-02-02 13:27:43 +07:00
parent 7f51781334
commit a6ab65adc4
18 changed files with 0 additions and 1199 deletions

View File

@ -1,46 +0,0 @@
<?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(),
]);
}
}

View File

@ -1,49 +0,0 @@
<?php
namespace Database\Factories;
use App\Models\Announcement;
use App\Models\AnnouncementMedia;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\AnnouncementMedia>
*/
class AnnouncementMediaFactory extends Factory
{
protected $model = AnnouncementMedia::class;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'announcement_id' => Announcement::factory(),
'partner_media_id' => PartnerMedia::factory(),
];
}
/**
* Indicate that the announcement user is for a specific announcement.
*/
public function forAnnouncement(Announcement $announcement): static
{
return $this->state(fn (array $attributes) => [
'announcement_id' => $announcement->id,
]);
}
/**
* Indicate that the announcement user is for a specific partner media.
*/
public function forPartnerMedia(PartnerMedia $partnerMedia): static
{
return $this->state(fn (array $attributes) => [
'partner_media_id' => $partnerMedia->id,
]);
}
}

View File

@ -1,50 +0,0 @@
<?php
namespace Database\Factories;
use App\Enums\IsActive;
use App\Models\Classification;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Classification>
*/
class ClassificationFactory extends Factory
{
protected $model = Classification::class;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'name' => $this->faker->words(2, true),
'description' => $this->faker->sentence(),
'is_active' => $this->faker->randomElement([IsActive::ACTIVE->value, IsActive::INACTIVE->value]),
'sort_order' => $this->faker->numberBetween(0, 100),
];
}
/**
* Indicate that the classification is active.
*/
public function active(): static
{
return $this->state(fn (array $attributes) => [
'is_active' => IsActive::ACTIVE->value,
]);
}
/**
* Indicate that the classification is inactive.
*/
public function inactive(): static
{
return $this->state(fn (array $attributes) => [
'is_active' => IsActive::INACTIVE->value,
]);
}
}

View File

@ -1,71 +0,0 @@
<?php
namespace Database\Factories;
use App\Enums\VerificationStatus;
use App\Models\Company;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Company>
*/
class CompanyFactory extends Factory
{
protected $model = Company::class;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'user_id' => User::factory(),
'name' => $this->faker->company(),
'email' => $this->faker->unique()->companyEmail(),
'address' => $this->faker->address(),
'director_name' => $this->faker->name(),
'director_nik' => $this->faker->numerify('################'),
'deed_incorporation' => $this->faker->numerify('AHU-#######.AH.##.##'),
'trade_license' => $this->faker->numerify('###/###/SIUP/####'),
'tax_id_number' => $this->faker->numerify('##.###.###.#-###.###'),
'taxable_enterprise' => $this->faker->numerify('###.###.###.###'),
'annual_tax_return' => $this->faker->numerify('SPT-####-########'),
'domicile_certificate' => $this->faker->numerify('###/###/DOMISILI/####'),
'profile' => $this->faker->numerify('PROFILE-####-########'),
'profile' => $this->faker->numerify('PROFILE-####-########'),
];
}
/**
* Indicate that the company is validated.
*/
public function validated(): static
{
return $this->state(fn (array $attributes) => [
'status' => VerificationStatus::APPROVED,
]);
}
/**
* Indicate that the company is rejected.
*/
public function rejected(): static
{
return $this->state(fn (array $attributes) => [
'status' => VerificationStatus::REJECTED,
]);
}
/**
* Indicate that the company is pending validation.
*/
public function pending(): static
{
return $this->state(fn (array $attributes) => [
'status' => VerificationStatus::PENDING,
]);
}
}

View File

@ -1,110 +0,0 @@
<?php
namespace Database\Factories;
use App\Enums\ContentType;
use App\Enums\SocialMedia;
use App\Models\Classification;
use App\Models\ContentRecap;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\ContentRecap>
*/
class ContentRecapFactory extends Factory
{
protected $model = ContentRecap::class;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
$channels = [
'Website',
'Facebook',
'Instagram',
'Twitter',
'YouTube',
'TikTok',
'WhatsApp',
'Telegram',
'LinkedIn',
];
return [
'classification_id' => Classification::factory(),
'title' => $this->faker->sentence(4),
'link' => $this->faker->optional(0.8)->url(),
'posting_date' => $this->faker->dateTimeBetween('-6 months', 'now')->format('Y-m-d'),
'type' => $this->faker->randomElement(ContentType::cases())->value,
'channel' => $this->faker->randomElement($channels),
'social_media' => $this->faker->randomElement(SocialMedia::cases())->value,
];
}
/**
* Indicate that the content recap is photo type.
*/
public function photo(): static
{
return $this->state(fn (array $attributes) => [
'type' => ContentType::FOTO->value,
]);
}
/**
* Indicate that the content recap is video type.
*/
public function video(): static
{
return $this->state(fn (array $attributes) => [
'type' => ContentType::VIDEO->value,
'channel' => $this->faker->randomElement(['YouTube', 'Instagram', 'TikTok']),
]);
}
/**
* Indicate that the content recap is text type.
*/
public function text(): static
{
return $this->state(fn (array $attributes) => [
'type' => ContentType::TEXT->value,
]);
}
/**
* Indicate that the content recap is graphic type.
*/
public function graphic(): static
{
return $this->state(fn (array $attributes) => [
'type' => ContentType::GRAPHIC->value,
]);
}
/**
* Indicate that the content recap is for Instagram.
*/
public function instagram(): static
{
return $this->state(fn (array $attributes) => [
'channel' => 'Instagram',
'social_media' => 'Instagram',
]);
}
/**
* Indicate that the content recap is for Facebook.
*/
public function facebook(): static
{
return $this->state(fn (array $attributes) => [
'channel' => 'Facebook',
'social_media' => 'Facebook',
]);
}
}

View File

@ -1,61 +0,0 @@
<?php
namespace Database\Factories;
use App\Enums\IsActive;
use App\Models\Department;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Department>
*/
class DepartmentFactory extends Factory
{
protected $model = Department::class;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
$name = $this->faker->randomElement([
'Dinas Komunikasi dan Informatika',
'Dinas Pendidikan',
'Dinas Kesehatan',
'Dinas Pekerjaan Umum',
'Dinas Sosial',
'Dinas Pariwisata',
'Dinas Perhubungan',
'Dinas Lingkungan Hidup',
]);
return [
'name' => $name,
'alias' => strtoupper(substr(str_replace(['Dinas ', ' dan ', ' '], ['', '', ''], $name), 0, 10)),
'is_active' => $this->faker->randomElement([IsActive::ACTIVE->value, IsActive::INACTIVE->value]),
'sort_order' => $this->faker->numberBetween(0, 100),
];
}
/**
* Indicate that the department is active.
*/
public function active(): static
{
return $this->state(fn (array $attributes) => [
'is_active' => IsActive::ACTIVE->value,
]);
}
/**
* Indicate that the department is inactive.
*/
public function inactive(): static
{
return $this->state(fn (array $attributes) => [
'is_active' => IsActive::INACTIVE->value,
]);
}
}

View File

@ -1,109 +0,0 @@
<?php
namespace Database\Factories;
use App\Enums\IssueSentiment;
use App\Models\Classification;
use App\Models\IssueManagement;
use App\Models\Location;
use App\Models\MediaMonitoring;
use App\Models\SubClassification;
use App\Models\SubLocation;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\IssueManagement>
*/
class IssueManagementFactory extends Factory
{
protected $model = IssueManagement::class;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'location_id' => Location::factory(),
'sub_location_id' => SubLocation::factory(),
'classification_id' => Classification::factory(),
'sub_classification_id' => SubClassification::factory(),
'media_monitoring_id' => MediaMonitoring::factory(),
'issue' => $this->faker->randomElement(IssueSentiment::cases())->value,
'response' => $this->faker->randomElement(IssueSentiment::cases())->value,
'description' => $this->faker->paragraphs(2, true),
];
}
/**
* Indicate that the issue is positive.
*/
public function positive(): static
{
return $this->state(fn (array $attributes) => [
'issue' => IssueSentiment::POSITIVE->value,
'response' => IssueSentiment::POSITIVE->value,
]);
}
/**
* Indicate that the issue is negative.
*/
public function negative(): static
{
return $this->state(fn (array $attributes) => [
'issue' => IssueSentiment::NEGATIVE->value,
'response' => $this->faker->randomElement([
IssueSentiment::POSITIVE->value,
IssueSentiment::NEUTRAL->value,
]),
]);
}
/**
* Indicate that the issue is neutral.
*/
public function neutral(): static
{
return $this->state(fn (array $attributes) => [
'issue' => IssueSentiment::NEUTRAL->value,
'response' => IssueSentiment::NEUTRAL->value,
]);
}
/**
* Indicate that the issue is crisis.
*/
public function crisis(): static
{
return $this->state(fn (array $attributes) => [
'issue' => IssueSentiment::CRISIS->value,
'response' => $this->faker->randomElement([
IssueSentiment::POSITIVE->value,
IssueSentiment::NEUTRAL->value,
]),
]);
}
/**
* Indicate that the issue has no sub location.
*/
public function withoutSubLocation(): static
{
return $this->state(fn (array $attributes) => [
'sub_location_id' => null,
]);
}
/**
* Indicate that the issue has no sub classification.
*/
public function withoutSubClassification(): static
{
return $this->state(fn (array $attributes) => [
'sub_classification_id' => null,
]);
}
}

View File

@ -1,54 +0,0 @@
<?php
namespace Database\Factories;
use App\Models\Journalist;
use App\Models\PartnerMedia;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Journalist>
*/
class JournalistFactory extends Factory
{
protected $model = Journalist::class;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'partner_media_id' => PartnerMedia::factory(),
'name' => $this->faker->name(),
'email' => $this->faker->unique()->safeEmail(),
'phone_number' => $this->faker->phoneNumber(),
'press_card' => $this->faker->optional(0.8)->numerify('PWI-####-########'),
'ukw_certificate' => $this->faker->optional(0.6)->numerify('UKW-####-########'),
];
}
/**
* Indicate that the journalist has press credentials.
*/
public function withCredentials(): static
{
return $this->state(fn (array $attributes) => [
'press_card' => $this->faker->numerify('PWI-####-########'),
'ukw_certificate' => $this->faker->numerify('UKW-####-########'),
]);
}
/**
* Indicate that the journalist has no credentials.
*/
public function withoutCredentials(): static
{
return $this->state(fn (array $attributes) => [
'press_card' => null,
'ukw_certificate' => null,
]);
}
}

View File

@ -1,50 +0,0 @@
<?php
namespace Database\Factories;
use App\Enums\IsActive;
use App\Models\Location;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Location>
*/
class LocationFactory extends Factory
{
protected $model = Location::class;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'name' => $this->faker->city(),
'description' => $this->faker->sentence(),
'is_active' => $this->faker->randomElement([IsActive::ACTIVE->value, IsActive::INACTIVE->value]),
'sort_order' => $this->faker->numberBetween(0, 100),
];
}
/**
* Indicate that the location is active.
*/
public function active(): static
{
return $this->state(fn (array $attributes) => [
'is_active' => IsActive::ACTIVE->value,
]);
}
/**
* Indicate that the location is inactive.
*/
public function inactive(): static
{
return $this->state(fn (array $attributes) => [
'is_active' => IsActive::INACTIVE->value,
]);
}
}

View File

@ -1,106 +0,0 @@
<?php
namespace Database\Factories;
use App\Models\MediaMonitoring;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\MediaMonitoring>
*/
class MediaMonitoringFactory extends Factory
{
protected $model = MediaMonitoring::class;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
$mediaNames = [
'Kompas.com',
'Detik.com',
'Tribun News',
'Liputan6',
'CNN Indonesia',
'ANTARA News',
'Tempo.co',
'Okezone',
'Suara.com',
'Bisnis.com',
];
$channels = [
'Website',
'Facebook',
'Instagram',
'Twitter',
'YouTube',
'TikTok',
'WhatsApp',
'Telegram',
'LinkedIn',
];
return [
'code' => $this->faker->unique()->regexify('[A-Z]{2}[0-9]{8}'),
'media_name' => $this->faker->randomElement($mediaNames),
'title' => $this->faker->sentence(6),
'channel' => $this->faker->randomElement($channels),
'writter' => $this->faker->name(),
'link' => $this->faker->optional(0.8)->url(),
'news_page' => $this->faker->optional(0.3)->numberBetween(1, 20),
'quote' => $this->faker->optional(0.4)->paragraph(),
'content' => $this->faker->paragraphs(3, true),
'influencer' => $this->faker->optional(0.2)->name(),
'keyword' => implode(', ', $this->faker->words(3)),
'release_date' => $this->faker->dateTimeBetween('-1 year', 'now')->format('Y-m-d'),
];
}
/**
* Indicate that the media monitoring is for online media.
*/
public function online(): static
{
return $this->state(fn (array $attributes) => [
'channel' => $this->faker->randomElement(['Website', 'Facebook', 'Instagram', 'Twitter']),
'link' => $this->faker->url(),
'news_page' => null,
]);
}
/**
* Indicate that the media monitoring is for print media.
*/
public function print(): static
{
return $this->state(fn (array $attributes) => [
'channel' => 'Print',
'link' => null,
'news_page' => $this->faker->numberBetween(1, 20),
]);
}
/**
* Indicate that the media monitoring has influencer mention.
*/
public function withInfluencer(): static
{
return $this->state(fn (array $attributes) => [
'influencer' => $this->faker->name(),
]);
}
/**
* Indicate that the media monitoring has quote.
*/
public function withQuote(): static
{
return $this->state(fn (array $attributes) => [
'quote' => $this->faker->paragraph(),
]);
}
}

View File

@ -1,29 +0,0 @@
<?php
namespace Database\Factories;
use App\Models\MediaMonitoring;
use App\Models\MediaMonitoringTheme;
use App\Models\Theme;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\MediaMonitoringTheme>
*/
class MediaMonitoringThemeFactory extends Factory
{
protected $model = MediaMonitoringTheme::class;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'media_monitoring_id' => MediaMonitoring::factory(),
'theme_id' => Theme::factory(),
];
}
}

View File

@ -1,65 +0,0 @@
<?php
namespace Database\Factories;
use App\Models\News;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\News>
*/
class NewsFactory extends Factory
{
protected $model = News::class;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
$title = $this->faker->sentence(6);
return [
'author_id' => User::factory(),
'title' => $title,
'slug' => Str::slug($title),
'content' => $this->faker->paragraphs(3, true),
'link' => $this->faker->optional(0.3)->url(),
'view' => $this->faker->numberBetween(0, 10000),
];
}
/**
* Indicate that the news has high views.
*/
public function popular(): static
{
return $this->state(fn (array $attributes) => [
'view' => $this->faker->numberBetween(5000, 50000),
]);
}
/**
* Indicate that the news has external link.
*/
public function withLink(): static
{
return $this->state(fn (array $attributes) => [
'link' => $this->faker->url(),
]);
}
/**
* Indicate that the news has no views.
*/
public function unpublished(): static
{
return $this->state(fn (array $attributes) => [
'view' => 0,
]);
}
}

View File

@ -1,81 +0,0 @@
<?php
namespace Database\Factories;
use App\Models\News;
use App\Models\NewsTags;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\NewsTags>
*/
class NewsTagsFactory extends Factory
{
protected $model = NewsTags::class;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
$tags = [
'Berita',
'Update',
'Pengumuman',
'Event',
'Kegiatan',
'Kominfo',
'Diskominfo',
'Pemerintah',
'Publik',
'Informasi',
'Layanan',
'Digital',
'Teknologi',
'Sosial',
'Ekonomi',
'Pendidikan',
'Kesehatan',
'Lingkungan',
'Infrastruktur',
'Transportasi',
];
return [
'news_id' => News::factory(),
'name' => $this->faker->randomElement($tags),
];
}
/**
* Indicate that the tag is for news category.
*/
public function news(): static
{
return $this->state(fn (array $attributes) => [
'name' => 'Berita',
]);
}
/**
* Indicate that the tag is for announcement category.
*/
public function announcement(): static
{
return $this->state(fn (array $attributes) => [
'name' => 'Pengumuman',
]);
}
/**
* Indicate that the tag is for event category.
*/
public function event(): static
{
return $this->state(fn (array $attributes) => [
'name' => 'Event',
]);
}
}

View File

@ -1,120 +0,0 @@
<?php
namespace Database\Factories;
use App\Enums\MediaClassification;
use App\Enums\MediaType;
use App\Models\Company;
use App\Models\PartnerMedia;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\PartnerMedia>
*/
class PartnerMediaFactory extends Factory
{
protected $model = PartnerMedia::class;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
$mediaNames = [
'Kompas.com',
'Detik.com',
'Tribun News',
'Liputan6',
'CNN Indonesia',
'ANTARA News',
'Tempo.co',
'Okezone',
'Suara.com',
'Bisnis.com',
'Media Indonesia',
'Republika',
'Koran Sindo',
'Pikiran Rakyat',
];
return [
'company_id' => Company::factory(),
'name' => $this->faker->randomElement($mediaNames),
'address' => $this->faker->address(),
'link' => $this->faker->optional(0.8)->domainName(),
'type' => $this->faker->randomElement(MediaType::cases())->value,
'classification' => $this->faker->randomElement(MediaClassification::cases())->value,
'journalism_organization' => $this->faker->optional(0.6)->randomElement([
'Persatuan Wartawan Indonesia (PWI)',
'Aliansi Jurnalis Independen (AJI)',
'Ikatan Jurnalis Televisi Indonesia (IJTI)',
'Persatuan Jurnalis Online Indonesia (PJOI)',
]),
'press_council_certificate' => $this->faker->optional(0.7)->numerify('DEP-###/####/KP'),
];
}
/**
* Indicate that the partner media is online type.
*/
public function online(): static
{
return $this->state(fn (array $attributes) => [
'type' => MediaType::ONLINE->value,
'link' => $this->faker->domainName(),
]);
}
/**
* Indicate that the partner media is print type.
*/
public function print(): static
{
return $this->state(fn (array $attributes) => [
'type' => MediaType::PRINT->value,
'link' => null,
]);
}
/**
* Indicate that the partner media is television type.
*/
public function television(): static
{
return $this->state(fn (array $attributes) => [
'type' => MediaType::TELEVISION->value,
]);
}
/**
* Indicate that the partner media is radio type.
*/
public function radio(): static
{
return $this->state(fn (array $attributes) => [
'type' => MediaType::RADIO->value,
]);
}
/**
* Indicate that the partner media is national classification.
*/
public function national(): static
{
return $this->state(fn (array $attributes) => [
'classification' => MediaClassification::NATIONAL->value,
]);
}
/**
* Indicate that the partner media is local classification.
*/
public function local(): static
{
return $this->state(fn (array $attributes) => [
'classification' => MediaClassification::LOCAL->value,
]);
}
}

View File

@ -1,52 +0,0 @@
<?php
namespace Database\Factories;
use App\Enums\IsActive;
use App\Models\Classification;
use App\Models\SubClassification;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\SubClassification>
*/
class SubClassificationFactory extends Factory
{
protected $model = SubClassification::class;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'classification_id' => Classification::factory(),
'name' => $this->faker->words(2, true),
'description' => $this->faker->sentence(),
'is_active' => $this->faker->randomElement([IsActive::ACTIVE->value, IsActive::INACTIVE->value]),
'sort_order' => $this->faker->numberBetween(0, 100),
];
}
/**
* Indicate that the sub classification is active.
*/
public function active(): static
{
return $this->state(fn (array $attributes) => [
'is_active' => IsActive::ACTIVE->value,
]);
}
/**
* Indicate that the sub classification is inactive.
*/
public function inactive(): static
{
return $this->state(fn (array $attributes) => [
'is_active' => IsActive::INACTIVE->value,
]);
}
}

View File

@ -1,52 +0,0 @@
<?php
namespace Database\Factories;
use App\Enums\IsActive;
use App\Models\Location;
use App\Models\SubLocation;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\SubLocation>
*/
class SubLocationFactory extends Factory
{
protected $model = SubLocation::class;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'location_id' => Location::factory(),
'name' => $this->faker->streetName(),
'description' => $this->faker->sentence(),
'is_active' => $this->faker->randomElement([IsActive::ACTIVE->value, IsActive::INACTIVE->value]),
'sort_order' => $this->faker->numberBetween(0, 100),
];
}
/**
* Indicate that the sub location is active.
*/
public function active(): static
{
return $this->state(fn (array $attributes) => [
'is_active' => IsActive::ACTIVE->value,
]);
}
/**
* Indicate that the sub location is inactive.
*/
public function inactive(): static
{
return $this->state(fn (array $attributes) => [
'is_active' => IsActive::INACTIVE->value,
]);
}
}

View File

@ -1,49 +0,0 @@
<?php
namespace Database\Factories;
use App\Enums\IsActive;
use App\Models\Theme;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Theme>
*/
class ThemeFactory extends Factory
{
protected $model = Theme::class;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'name' => $this->faker->words(2, true),
'is_active' => $this->faker->randomElement([IsActive::ACTIVE->value, IsActive::INACTIVE->value]),
'sort_order' => $this->faker->numberBetween(0, 100),
];
}
/**
* Indicate that the theme is active.
*/
public function active(): static
{
return $this->state(fn (array $attributes) => [
'is_active' => IsActive::ACTIVE->value,
]);
}
/**
* Indicate that the theme is inactive.
*/
public function inactive(): static
{
return $this->state(fn (array $attributes) => [
'is_active' => IsActive::INACTIVE->value,
]);
}
}

View File

@ -1,45 +0,0 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
*/
class UserFactory extends Factory
{
/**
* The current password being used by the factory.
*/
protected static ?string $password;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'name' => fake()->name(),
'email' => fake()->unique()->safeEmail(),
'username' => $this->faker->unique()->bothify('?????#####'),
'email_verified_at' => now(),
'password' => static::$password ??= Hash::make(config('auth.password_default')),
'remember_token' => Str::random(10),
];
}
/**
* Indicate that the model's email address should be unverified.
*/
public function unverified(): static
{
return $this->state(fn (array $attributes) => [
'email_verified_at' => null,
]);
}
}