Merge branch 'dev' into 'main'
Refactor database migrations to use explicit foreign key constraints with... See merge request pratama/purwakarta/diskominfo/simedkom!4
This commit is contained in:
commit
c6b7f6c6a4
@ -139,11 +139,11 @@ public static function infolist(Schema $schema): Schema
|
||||
|
||||
ImageEntry::make('banner')
|
||||
->label('Banner')
|
||||
->getStateUsing(fn (Cooperation $record): ?string => optional($record->getMedia('cooperations')->where('custom_properties.doc_type', 'banner')->sortByDesc('created_at')->first())->getPathRelativeToRoot())
|
||||
->getStateUsing(fn (Cooperation $record): ?string => optional($record->getMedia('banner')->sortByDesc('created_at')->first() ?? $record->getMedia('cooperations')->where('custom_properties.doc_type', 'banner')->sortByDesc('created_at')->first())->getPathRelativeToRoot())
|
||||
->disk(config('filesystems.default'))
|
||||
->visible(fn (Cooperation $record): bool => $record->getMedia('cooperations')->where('custom_properties.doc_type', 'banner')->isNotEmpty()),
|
||||
->visible(fn (Cooperation $record): bool => $record->getMedia('banner')->isNotEmpty() || $record->getMedia('cooperations')->where('custom_properties.doc_type', 'banner')->isNotEmpty()),
|
||||
])
|
||||
->visible(fn (Cooperation $record): bool => $record->getMedia('cooperations')->where('custom_properties.doc_type', 'banner')->isNotEmpty() && $record->getMedia('cooperations')->where('custom_properties.doc_type', 'proposal-template')->isNotEmpty()),
|
||||
->visible(fn (Cooperation $record): bool => $record->getMedia('banner')->isNotEmpty() || $record->getMedia('cooperations')->where('custom_properties.doc_type', 'banner')->isNotEmpty() || $record->getMedia('cooperations')->where('custom_properties.doc_type', 'proposal-template')->isNotEmpty()),
|
||||
|
||||
TextEntry::make('description')
|
||||
->label('Deskripsi'),
|
||||
|
||||
@ -90,7 +90,7 @@ public static function configure(Schema $schema): Schema
|
||||
->disk(config('filesystems.default'))
|
||||
->acceptedFileTypes(['image/*'])
|
||||
->maxSize(1024 * 3)
|
||||
->collection('cooperations')
|
||||
->collection('banner')
|
||||
->customProperties(fn (): array => [
|
||||
'feature' => 'cooperations',
|
||||
'doc_type' => 'banner',
|
||||
|
||||
@ -139,7 +139,7 @@ public static function table(Table $table): Table
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make()
|
||||
->modalWidth(Width::TwoExtraLarge)
|
||||
->modalWidth(Width::FiveExtraLarge)
|
||||
->visible(fn (Announcement $record): bool => $record->type === AnnouncementType::PUBLIC),
|
||||
|
||||
DeleteAction::make(),
|
||||
|
||||
@ -30,7 +30,7 @@ protected function getHeaderActions(): array
|
||||
$action->makeModalSubmitAction('createAnother', arguments: ['another' => true])
|
||||
->label('Simpan dan Tambah Lagi'),
|
||||
])
|
||||
->modalWidth(Width::TwoExtraLarge)
|
||||
->modalWidth(Width::FiveExtraLarge)
|
||||
->after(function (array $data) {
|
||||
if ($data['type'] === AnnouncementType::PUBLIC) {
|
||||
return;
|
||||
|
||||
@ -13,6 +13,14 @@ class AnnouncementMedia extends Model
|
||||
|
||||
protected $guarded = ['id'];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'announcement_id' => 'integer',
|
||||
'partner_media_id' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
public function announcement(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Announcement::class);
|
||||
|
||||
@ -37,11 +37,6 @@ protected function inactive(Builder $query): void
|
||||
$query->where('is_active', IsActive::INACTIVE);
|
||||
}
|
||||
|
||||
public function subClassifications(): HasMany
|
||||
{
|
||||
return $this->hasMany(SubClassification::class);
|
||||
}
|
||||
|
||||
public function contentRecaps(): HasMany
|
||||
{
|
||||
return $this->hasMany(ContentRecap::class);
|
||||
@ -51,4 +46,9 @@ public function issueManagements(): HasMany
|
||||
{
|
||||
return $this->hasMany(IssueManagement::class);
|
||||
}
|
||||
|
||||
public function subClassifications(): HasMany
|
||||
{
|
||||
return $this->hasMany(SubClassification::class);
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,6 +18,13 @@ class Company extends Model implements HasMedia
|
||||
|
||||
protected $guarded = ['id'];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'user_id' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
public function journalists(): HasManyThrough
|
||||
{
|
||||
return $this->hasManyThrough(Journalist::class, PartnerMedia::class);
|
||||
|
||||
@ -12,6 +12,14 @@ class Contact extends Model
|
||||
|
||||
protected $guarded = ['id'];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'replied_at' => 'datetime',
|
||||
'replied_by' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
public function repliedBy(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'replied_by');
|
||||
|
||||
@ -22,6 +22,7 @@ protected function casts(): array
|
||||
return [
|
||||
'type' => ContentType::class,
|
||||
'posting_date' => 'date',
|
||||
'classification_id' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@ -77,6 +77,16 @@ public function partnerMedia(): BelongsToMany
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function payments(): HasManyThrough
|
||||
{
|
||||
return $this->hasManyThrough(
|
||||
CooperationPayment::class,
|
||||
CooperationMedia::class,
|
||||
'cooperation_id',
|
||||
'cooperation_media_id'
|
||||
);
|
||||
}
|
||||
|
||||
public function proposal(): HasMany
|
||||
{
|
||||
return $this->hasMany(CooperationProposal::class);
|
||||
@ -96,14 +106,4 @@ public function taskAssignment(): HasOne
|
||||
{
|
||||
return $this->hasOne(TaskAssignment::class);
|
||||
}
|
||||
|
||||
public function payments(): HasManyThrough
|
||||
{
|
||||
return $this->hasManyThrough(
|
||||
CooperationPayment::class,
|
||||
CooperationMedia::class,
|
||||
'cooperation_id',
|
||||
'cooperation_media_id'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,6 +26,8 @@ protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'status' => ApprovalStatus::class,
|
||||
'cooperation_id' => 'integer',
|
||||
'partner_media_id' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@ -20,6 +20,7 @@ protected function casts(): array
|
||||
return [
|
||||
'amount' => 'integer',
|
||||
'payment_date' => 'date',
|
||||
'cooperation_media_id' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@ -24,6 +24,8 @@ protected function casts(): array
|
||||
'status' => DataChangeStatus::class,
|
||||
'old_data' => 'array',
|
||||
'new_data' => 'array',
|
||||
'user_id' => 'integer',
|
||||
'entity_id' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
@ -45,9 +47,9 @@ protected function rejected(Builder $query): void
|
||||
$query->where('status', DataChangeStatus::REJECTED);
|
||||
}
|
||||
|
||||
public function user(): BelongsTo
|
||||
public function entity(): MorphTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
return $this->morphTo();
|
||||
}
|
||||
|
||||
public function review(): HasOne
|
||||
@ -55,8 +57,8 @@ public function review(): HasOne
|
||||
return $this->hasOne(DataChangeReview::class);
|
||||
}
|
||||
|
||||
public function entity(): MorphTo
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->morphTo();
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,6 +17,8 @@ protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'decision' => DataChangeDecision::class,
|
||||
'data_change_request_id' => 'integer',
|
||||
'reviewer_id' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@ -20,31 +20,36 @@ protected function casts(): array
|
||||
return [
|
||||
'issue' => IssueSentiment::class,
|
||||
'response' => IssueSentiment::class,
|
||||
'location_id' => 'integer',
|
||||
'sub_location_id' => 'integer',
|
||||
'classification_id' => 'integer',
|
||||
'sub_classification_id' => 'integer',
|
||||
'media_monitoring_id' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
public function location(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Location::class);
|
||||
}
|
||||
|
||||
public function subLocation(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(SubLocation::class);
|
||||
}
|
||||
|
||||
public function classification(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Classification::class);
|
||||
}
|
||||
|
||||
public function subClassification(): BelongsTo
|
||||
public function location(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(SubClassification::class);
|
||||
return $this->belongsTo(Location::class);
|
||||
}
|
||||
|
||||
public function mediaMonitoring(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(MediaMonitoring::class);
|
||||
}
|
||||
|
||||
public function subClassification(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(SubClassification::class);
|
||||
}
|
||||
|
||||
public function subLocation(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(SubLocation::class);
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,6 +17,13 @@ class Journalist extends Model implements HasMedia
|
||||
|
||||
protected $guarded = ['id'];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'partner_media_id' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
public function partnerMedia(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(PartnerMedia::class);
|
||||
|
||||
@ -15,6 +15,14 @@ class MediaMonitoringTheme extends Model
|
||||
|
||||
protected $guarded = ['id'];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'media_monitoring_id' => 'integer',
|
||||
'theme_id' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
public function mediaMonitoring(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(MediaMonitoring::class);
|
||||
|
||||
@ -22,14 +22,11 @@ protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'status' => ApprovalStatus::class,
|
||||
'task_assignment_id' => 'integer',
|
||||
'partner_media_id' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
public function taskAssignment(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(TaskAssignment::class);
|
||||
}
|
||||
|
||||
public function partnerMedia(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(PartnerMedia::class);
|
||||
@ -44,4 +41,9 @@ public function reports(): HasMany
|
||||
{
|
||||
return $this->hasMany(Report::class);
|
||||
}
|
||||
|
||||
public function taskAssignment(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(TaskAssignment::class);
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,9 +26,10 @@ class News extends Model implements HasMedia
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'views' => 'int',
|
||||
'views' => 'integer',
|
||||
'status' => NewsStatus::class,
|
||||
'published_at' => 'datetime',
|
||||
'author_id' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@ -28,6 +28,7 @@ protected function casts(): array
|
||||
return [
|
||||
'type' => MediaType::class,
|
||||
'classification' => MediaClassification::class,
|
||||
'company_id' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@ -13,6 +13,13 @@ class RejectionReason extends Model
|
||||
|
||||
protected $guarded = ['id'];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'rejectable_id' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
public function rejectable(): MorphTo
|
||||
{
|
||||
return $this->morphTo();
|
||||
|
||||
@ -23,6 +23,7 @@ protected function casts(): array
|
||||
return [
|
||||
'publication_date' => 'date',
|
||||
'status' => ApprovalStatus::class,
|
||||
'media_task_assignment_id' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@ -23,6 +23,7 @@ protected function casts(): array
|
||||
return [
|
||||
'is_active' => IsActive::class,
|
||||
'sort_order' => 'integer',
|
||||
'classification_id' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@ -23,6 +23,7 @@ protected function casts(): array
|
||||
return [
|
||||
'is_active' => IsActive::class,
|
||||
'sort_order' => 'integer',
|
||||
'location_id' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@ -22,6 +22,8 @@ protected function casts(): array
|
||||
return [
|
||||
'start_date' => 'date',
|
||||
'end_date' => 'date',
|
||||
'report_amount' => 'integer',
|
||||
'cooperation_id' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
@ -30,23 +32,6 @@ public function cooperation(): BelongsTo
|
||||
return $this->belongsTo(Cooperation::class);
|
||||
}
|
||||
|
||||
public function reports(): HasManyThrough
|
||||
{
|
||||
return $this->hasManyThrough(
|
||||
Report::class,
|
||||
MediaTaskAssignment::class,
|
||||
'task_assignment_id', // Foreign key di tabel media_task_assignment
|
||||
'media_task_assignment_id', // Foreign key di tabel reports
|
||||
'id', // Local key di tabel task_assignments
|
||||
'id' // Local key di tabel media_task_assignment
|
||||
);
|
||||
}
|
||||
|
||||
public function rejectionReasons(): MorphMany
|
||||
{
|
||||
return $this->morphMany(RejectionReason::class, 'rejectable');
|
||||
}
|
||||
|
||||
public function mediaTaskAssignments(): HasMany
|
||||
{
|
||||
return $this->hasMany(MediaTaskAssignment::class);
|
||||
@ -59,4 +44,21 @@ public function partnerMedia(): BelongsToMany
|
||||
->withPivot(['status'])
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function rejectionReasons(): MorphMany
|
||||
{
|
||||
return $this->morphMany(RejectionReason::class, 'rejectable');
|
||||
}
|
||||
|
||||
public function reports(): HasManyThrough
|
||||
{
|
||||
return $this->hasManyThrough(
|
||||
Report::class,
|
||||
MediaTaskAssignment::class,
|
||||
'task_assignment_id',
|
||||
'media_task_assignment_id',
|
||||
'id',
|
||||
'id'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,6 +77,16 @@ public function contacts(): HasMany
|
||||
return $this->hasMany(Contact::class, 'replied_by');
|
||||
}
|
||||
|
||||
public function dataChangeRequests(): HasMany
|
||||
{
|
||||
return $this->hasMany(DataChangeRequest::class);
|
||||
}
|
||||
|
||||
public function dataChangeReviews(): HasMany
|
||||
{
|
||||
return $this->hasMany(DataChangeReview::class, 'reviewer_id');
|
||||
}
|
||||
|
||||
public function news(): HasMany
|
||||
{
|
||||
return $this->hasMany(News::class, 'author_id');
|
||||
|
||||
@ -21,6 +21,8 @@ protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'status' => VerificationStatus::class,
|
||||
'company_id' => 'integer',
|
||||
'submitted_by' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@ -20,6 +20,8 @@ protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'decision' => DecisionAdmin::class,
|
||||
'verification_request_id' => 'integer',
|
||||
'reviewer_id' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
@ -41,13 +43,13 @@ protected function rejected(Builder $query): void
|
||||
$query->where('decision', DecisionAdmin::REJECTED);
|
||||
}
|
||||
|
||||
public function verificationRequest(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(VerificationRequest::class);
|
||||
}
|
||||
|
||||
public function reviewer(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'reviewer_id');
|
||||
}
|
||||
|
||||
public function verificationRequest(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(VerificationRequest::class);
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,6 +63,26 @@
|
||||
]) : [],
|
||||
],
|
||||
|
||||
'mysql_second' => [
|
||||
'driver' => 'mysql',
|
||||
'url' => env('DB_SECOND_URL'),
|
||||
'host' => env('DB_SECOND_HOST', '127.0.0.1'),
|
||||
'port' => env('DB_SECOND_PORT', '3306'),
|
||||
'database' => env('DB_SECOND_DATABASE', 'laravel'),
|
||||
'username' => env('DB_SECOND_USERNAME', 'root'),
|
||||
'password' => env('DB_SECOND_PASSWORD', ''),
|
||||
'unix_socket' => env('DB_SECOND_SOCKET', ''),
|
||||
'charset' => env('DB_SECOND_CHARSET', 'utf8mb4'),
|
||||
'collation' => env('DB_SECOND_COLLATION', 'utf8mb4_unicode_ci'),
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
'strict' => true,
|
||||
'engine' => null,
|
||||
'options' => extension_loaded('pdo_mysql') ? array_filter([
|
||||
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
|
||||
]) : [],
|
||||
],
|
||||
|
||||
'mariadb' => [
|
||||
'driver' => 'mariadb',
|
||||
'url' => env('DB_URL'),
|
||||
|
||||
@ -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(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -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,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -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,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -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,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -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',
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -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,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -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,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -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,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -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,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -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(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -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(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@ -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,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -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',
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -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,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -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,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -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,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -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,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -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,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -20,7 +20,7 @@ public function up(): void
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->string('password');
|
||||
$table->rememberToken();
|
||||
$table->enum('is_active', [IsActive::values()])->default(IsActive::ACTIVE)->comment(IsActive::comment());
|
||||
$table->enum('is_active', IsActive::values())->default(IsActive::ACTIVE->value)->comment(IsActive::comment())->index();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->nullable()->useCurrentOnUpdate();
|
||||
$table->softDeletes();
|
||||
|
||||
@ -14,10 +14,10 @@ public function up(): void
|
||||
{
|
||||
Schema::create('classifications', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name', 50);
|
||||
$table->string('name', 50)->index();
|
||||
$table->text('description')->nullable();
|
||||
$table->enum('is_active', [IsActive::values()])->default(IsActive::ACTIVE->value)->comment(IsActive::comment());
|
||||
$table->integer('sort_order')->default(0);
|
||||
$table->enum('is_active', IsActive::values())->default(IsActive::ACTIVE->value)->comment(IsActive::comment())->index();
|
||||
$table->integer('sort_order')->default(0)->index();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->nullable()->useCurrentOnUpdate();
|
||||
$table->softDeletes();
|
||||
|
||||
@ -15,10 +15,10 @@ public function up(): void
|
||||
Schema::create('sub_classifications', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('classification_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('name', 50);
|
||||
$table->string('name', 50)->index();
|
||||
$table->text('description')->nullable();
|
||||
$table->enum('is_active', [IsActive::values()])->default(IsActive::ACTIVE->value)->comment(IsActive::comment());
|
||||
$table->integer('sort_order')->default(0);
|
||||
$table->enum('is_active', IsActive::values())->default(IsActive::ACTIVE->value)->comment(IsActive::comment());
|
||||
$table->integer('sort_order')->default(0)->index();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->nullable()->useCurrentOnUpdate();
|
||||
$table->softDeletes();
|
||||
|
||||
@ -14,10 +14,10 @@ public function up(): void
|
||||
{
|
||||
Schema::create('locations', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name', 50);
|
||||
$table->string('name', 50)->index();
|
||||
$table->text('description')->nullable();
|
||||
$table->enum('is_active', [IsActive::values()])->default(IsActive::ACTIVE->value)->comment(IsActive::comment());
|
||||
$table->integer('sort_order')->default(0);
|
||||
$table->enum('is_active', IsActive::values())->default(IsActive::ACTIVE->value)->comment(IsActive::comment())->index();
|
||||
$table->integer('sort_order')->default(0)->index();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->nullable()->useCurrentOnUpdate();
|
||||
$table->softDeletes();
|
||||
|
||||
@ -15,10 +15,10 @@ public function up(): void
|
||||
Schema::create('sub_locations', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('location_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('name', 50);
|
||||
$table->string('name', 50)->index();
|
||||
$table->text('description')->nullable();
|
||||
$table->enum('is_active', [IsActive::values()])->default(IsActive::ACTIVE->value)->comment(IsActive::comment());
|
||||
$table->integer('sort_order')->default(0);
|
||||
$table->enum('is_active', IsActive::values())->default(IsActive::ACTIVE->value)->comment(IsActive::comment());
|
||||
$table->integer('sort_order')->default(0)->index();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->nullable()->useCurrentOnUpdate();
|
||||
$table->softDeletes();
|
||||
|
||||
@ -14,10 +14,10 @@ public function up(): void
|
||||
{
|
||||
Schema::create('departments', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name', 100);
|
||||
$table->string('alias', 20);
|
||||
$table->enum('is_active', [IsActive::values()])->default(IsActive::ACTIVE->value)->comment(IsActive::comment());
|
||||
$table->integer('sort_order')->default(0);
|
||||
$table->string('name', 100)->index();
|
||||
$table->string('alias', 20)->index();
|
||||
$table->enum('is_active', IsActive::values())->default(IsActive::ACTIVE->value)->comment(IsActive::comment())->index();
|
||||
$table->integer('sort_order')->default(0)->index();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->nullable()->useCurrentOnUpdate();
|
||||
$table->softDeletes();
|
||||
|
||||
@ -14,9 +14,9 @@ public function up(): void
|
||||
{
|
||||
Schema::create('themes', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name', 50);
|
||||
$table->enum('is_active', [IsActive::values()])->default(IsActive::ACTIVE->value)->comment(IsActive::comment());
|
||||
$table->integer('sort_order')->default(0);
|
||||
$table->string('name', 50)->index();
|
||||
$table->enum('is_active', IsActive::values())->default(IsActive::ACTIVE->value)->comment(IsActive::comment())->index();
|
||||
$table->integer('sort_order')->default(0)->index();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->nullable()->useCurrentOnUpdate();
|
||||
$table->softDeletes();
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
@ -14,9 +13,9 @@ public function up(): void
|
||||
{
|
||||
Schema::create('companies', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignIdFor(User::class);
|
||||
$table->string('name', 100);
|
||||
$table->string('email', 254);
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('name', 100)->index();
|
||||
$table->string('email', 254)->index();
|
||||
$table->text('address');
|
||||
$table->string('director_name', 100);
|
||||
$table->string('director_nik', 16);
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
|
||||
use App\Enums\MediaClassification;
|
||||
use App\Enums\MediaType;
|
||||
use App\Models\Company;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
@ -16,12 +15,12 @@ public function up(): void
|
||||
{
|
||||
Schema::create('partner_media', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignIdFor(Company::class);
|
||||
$table->string('name', 50);
|
||||
$table->foreignId('company_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('name', 50)->index();
|
||||
$table->text('address');
|
||||
$table->string('link', 50)->nullable();
|
||||
$table->enum('type', [MediaType::values()])->default(MediaType::ONLINE)->comment(MediaType::comment());
|
||||
$table->enum('classification', [MediaClassification::values()])->comment(MediaClassification::comment());
|
||||
$table->enum('type', MediaType::values())->default(MediaType::ONLINE)->comment(MediaType::comment())->index();
|
||||
$table->enum('classification', MediaClassification::values())->comment(MediaClassification::comment())->index();
|
||||
$table->string('journalism_organization')->nullable();
|
||||
$table->string('press_council_certificate')->nullable();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
use App\Models\PartnerMedia;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
@ -14,10 +13,10 @@ public function up(): void
|
||||
{
|
||||
Schema::create('journalists', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignIdFor(PartnerMedia::class);
|
||||
$table->string('name', 100);
|
||||
$table->string('email', 254);
|
||||
$table->string('phone_number', 20);
|
||||
$table->foreignId('partner_media_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('name', 100)->index();
|
||||
$table->string('email', 254)->index();
|
||||
$table->string('phone_number', 20)->index();
|
||||
$table->string('press_card', 100)->nullable();
|
||||
$table->string('ukw_certificate', 100)->nullable();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
|
||||
@ -14,17 +14,17 @@ public function up(): void
|
||||
Schema::create('media_monitorings', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('code', 10);
|
||||
$table->string('media_name', 50);
|
||||
$table->string('media_name', 50)->index();
|
||||
$table->text('title', 255);
|
||||
$table->string('channel', 20);
|
||||
$table->string('channel', 20)->index();
|
||||
$table->string('writter', 50);
|
||||
$table->text('link', 50)->nullable();
|
||||
$table->string('news_page', 20)->nullable();
|
||||
$table->text('quote')->nullable();
|
||||
$table->text('content');
|
||||
$table->string('influencer', 50)->nullable();
|
||||
$table->string('keyword', 100);
|
||||
$table->date('release_date');
|
||||
$table->string('keyword', 100)->index();
|
||||
$table->date('release_date')->index();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->nullable()->useCurrentOnUpdate();
|
||||
$table->softDeletes();
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
<?php
|
||||
|
||||
use App\Models\MediaMonitoring;
|
||||
use App\Models\Theme;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
@ -15,8 +13,8 @@ public function up(): void
|
||||
{
|
||||
Schema::create('media_monitoring_theme', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignIdFor(MediaMonitoring::class);
|
||||
$table->foreignIdFor(Theme::class);
|
||||
$table->foreignId('media_monitoring_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('theme_id')->constrained()->cascadeOnDelete();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->nullable()->useCurrentOnUpdate();
|
||||
});
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Enums\ContentType;
|
||||
use App\Models\Classification;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
@ -15,13 +14,13 @@ public function up(): void
|
||||
{
|
||||
Schema::create('content_recaps', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignIdFor(Classification::class)->constrained();
|
||||
$table->foreignId('classification_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('title', 255);
|
||||
$table->text('link', 50)->nullable();
|
||||
$table->date('posting_date');
|
||||
$table->enum('type', [ContentType::values()])->default(ContentType::FOTO);
|
||||
$table->string('channel', 20);
|
||||
$table->string('social_media', 50);
|
||||
$table->date('posting_date')->index();
|
||||
$table->enum('type', ContentType::values())->default(ContentType::FOTO)->index();
|
||||
$table->string('channel', 20)->index();
|
||||
$table->string('social_media', 50)->index();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->nullable()->useCurrentOnUpdate();
|
||||
$table->softDeletes();
|
||||
|
||||
@ -1,11 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Enums\IssueSentiment;
|
||||
use App\Models\Classification;
|
||||
use App\Models\Location;
|
||||
use App\Models\MediaMonitoring;
|
||||
use App\Models\SubClassification;
|
||||
use App\Models\SubLocation;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
@ -19,13 +14,13 @@ public function up(): void
|
||||
{
|
||||
Schema::create('issue_management', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignIdFor(Location::class)->constrained()->cascadeOnDelete();
|
||||
$table->foreignIdFor(SubLocation::class)->nullable()->constrained()->nullOnDelete();
|
||||
$table->foreignIdFor(Classification::class)->constrained()->cascadeOnDelete();
|
||||
$table->foreignIdFor(SubClassification::class)->nullable()->constrained()->nullOnDelete();
|
||||
$table->foreignIdFor(MediaMonitoring::class)->constrained()->cascadeOnDelete();
|
||||
$table->enum('issue', [IssueSentiment::values()])->comment(IssueSentiment::comment());
|
||||
$table->enum('response', [IssueSentiment::values()])->comment(IssueSentiment::comment());
|
||||
$table->foreignId('location_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('sub_location_id')->nullable()->constrained()->nullOnDelete();
|
||||
$table->foreignId('classification_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('sub_classification_id')->nullable()->constrained()->nullOnDelete();
|
||||
$table->foreignId('media_monitoring_id')->constrained()->cascadeOnDelete();
|
||||
$table->enum('issue', IssueSentiment::values())->comment(IssueSentiment::comment())->index();
|
||||
$table->enum('response', IssueSentiment::values())->comment(IssueSentiment::comment())->index();
|
||||
$table->text('description');
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->nullable()->useCurrentOnUpdate();
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Enums\NewsStatus;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
@ -15,15 +14,15 @@ public function up(): void
|
||||
{
|
||||
Schema::create('news', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignIdFor(User::class, 'author_id');
|
||||
$table->foreignId('author_id')->constrained('users')->cascadeOnDelete();
|
||||
$table->string('title', 200);
|
||||
$table->string('slug', 200);
|
||||
$table->string('slug', 200)->index();
|
||||
$table->text('content');
|
||||
$table->text('excerpt');
|
||||
$table->string('link', 50)->nullable();
|
||||
$table->unsignedInteger('views')->default(0);
|
||||
$table->enum('status', [NewsStatus::values()])->comment(NewsStatus::comment());
|
||||
$table->timestamp('published_at')->nullable();
|
||||
$table->unsignedInteger('views')->default(0)->index();
|
||||
$table->enum('status', NewsStatus::values())->comment(NewsStatus::comment())->index();
|
||||
$table->timestamp('published_at')->nullable()->index();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->nullable()->useCurrentOnUpdate();
|
||||
$table->softDeletes();
|
||||
|
||||
@ -15,13 +15,13 @@ public function up(): void
|
||||
Schema::create('cooperations', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('title', 200);
|
||||
$table->date('initial_submission_date');
|
||||
$table->date('final_submission_date');
|
||||
$table->date('initial_submission_date')->index();
|
||||
$table->date('final_submission_date')->index();
|
||||
$table->text('description');
|
||||
$table->unsignedInteger('payment_amount')->nullable();
|
||||
$table->date('payment_date')->nullable();
|
||||
$table->date('completed_at')->nullable();
|
||||
$table->enum('status', CooperationStatus::values())->default(CooperationStatus::PENDING)->comment(CooperationStatus::comment());
|
||||
$table->enum('status', CooperationStatus::values())->default(CooperationStatus::PENDING)->comment(CooperationStatus::comment())->index();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->nullable()->useCurrentOnUpdate();
|
||||
$table->softDeletes();
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Enums\ApprovalStatus;
|
||||
use App\Models\Cooperation;
|
||||
use App\Models\PartnerMedia;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
@ -16,9 +14,9 @@ public function up(): void
|
||||
{
|
||||
Schema::create('cooperation_media', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignIdFor(Cooperation::class)->constrained()->cascadeOnDelete();
|
||||
$table->foreignIdFor(PartnerMedia::class)->constrained()->cascadeOnDelete();
|
||||
$table->enum('status', ApprovalStatus::values())->default(ApprovalStatus::PENDING)->comment(ApprovalStatus::comment());
|
||||
$table->foreignId('cooperation_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('partner_media_id')->constrained()->cascadeOnDelete();
|
||||
$table->enum('status', ApprovalStatus::values())->default(ApprovalStatus::PENDING)->comment(ApprovalStatus::comment())->index();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->nullable()->useCurrentOnUpdate();
|
||||
});
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Cooperation;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
@ -14,9 +13,9 @@ public function up(): void
|
||||
{
|
||||
Schema::create('task_assignments', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignIdFor(Cooperation::class)->constrained()->cascadeOnDelete();
|
||||
$table->date('start_date');
|
||||
$table->date('end_date');
|
||||
$table->foreignId('cooperation_id')->constrained()->cascadeOnDelete();
|
||||
$table->date('start_date')->index();
|
||||
$table->date('end_date')->index();
|
||||
$table->text('task_description');
|
||||
$table->unsignedInteger('report_amount');
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Enums\ApprovalStatus;
|
||||
use App\Models\PartnerMedia;
|
||||
use App\Models\TaskAssignment;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
@ -16,9 +14,9 @@ public function up(): void
|
||||
{
|
||||
Schema::create('media_task_assignment', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignIdFor(TaskAssignment::class)->constrained()->cascadeOnDelete();
|
||||
$table->foreignIdFor(PartnerMedia::class)->constrained()->cascadeOnDelete();
|
||||
$table->enum('status', ApprovalStatus::values())->default(ApprovalStatus::PENDING)->comment(ApprovalStatus::comment());
|
||||
$table->foreignId('task_assignment_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('partner_media_id')->constrained()->cascadeOnDelete();
|
||||
$table->enum('status', ApprovalStatus::values())->default(ApprovalStatus::PENDING)->comment(ApprovalStatus::comment())->index();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->nullable()->useCurrentOnUpdate();
|
||||
});
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Enums\ApprovalStatus;
|
||||
use App\Models\MediaTaskAssignment;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
@ -15,12 +14,12 @@ public function up(): void
|
||||
{
|
||||
Schema::create('reports', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignIdFor(MediaTaskAssignment::class)->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('media_task_assignment_id')->constrained('media_task_assignment')->cascadeOnDelete();
|
||||
$table->string('title', 200);
|
||||
$table->date('publication_date');
|
||||
$table->date('publication_date')->index();
|
||||
$table->string('link', 50);
|
||||
$table->text('description');
|
||||
$table->enum('status', ApprovalStatus::values())->default(ApprovalStatus::PENDING)->comment(ApprovalStatus::comment());
|
||||
$table->enum('status', ApprovalStatus::values())->default(ApprovalStatus::PENDING)->comment(ApprovalStatus::comment())->index();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->nullable()->useCurrentOnUpdate();
|
||||
$table->softDeletes();
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Enums\VerificationStatus;
|
||||
use App\Models\Company;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
@ -16,9 +14,9 @@ public function up(): void
|
||||
{
|
||||
Schema::create('verification_requests', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignIdFor(Company::class);
|
||||
$table->foreignIdFor(User::class, 'submitted_by');
|
||||
$table->enum('status', VerificationStatus::cases())->default(VerificationStatus::PENDING)->comment(VerificationStatus::comment());
|
||||
$table->foreignId('company_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('submitted_by')->constrained('users')->cascadeOnDelete();
|
||||
$table->enum('status', VerificationStatus::values())->default(VerificationStatus::PENDING->value)->comment(VerificationStatus::comment())->index();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->nullable()->useCurrentOnUpdate();
|
||||
$table->softDeletes();
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Enums\DecisionAdmin;
|
||||
use App\Models\User;
|
||||
use App\Models\VerificationRequest;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
@ -16,9 +14,9 @@ public function up(): void
|
||||
{
|
||||
Schema::create('verification_reviews', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignIdFor(VerificationRequest::class);
|
||||
$table->foreignIdFor(User::class, 'reviewer_id');
|
||||
$table->enum('decision', DecisionAdmin::cases())->comment(DecisionAdmin::comment());
|
||||
$table->foreignId('verification_request_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('reviewer_id')->constrained('users')->cascadeOnDelete();
|
||||
$table->enum('decision', DecisionAdmin::values())->comment(DecisionAdmin::comment())->index();
|
||||
$table->text('note')->nullable();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->nullable()->useCurrentOnUpdate();
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
use App\Models\CooperationMedia;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
@ -14,10 +13,10 @@ public function up(): void
|
||||
{
|
||||
Schema::create('cooperation_payments', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignIdFor(CooperationMedia::class, 'cooperation_media_id')->constrained()->cascadeOnDelete();
|
||||
$table->unsignedInteger('amount');
|
||||
$table->foreignId('cooperation_media_id')->constrained('cooperation_media')->cascadeOnDelete();
|
||||
$table->unsignedInteger('amount')->index();
|
||||
$table->text('description')->nullable();
|
||||
$table->date('payment_date')->useCurrent();
|
||||
$table->date('payment_date')->useCurrent()->index();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->nullable()->useCurrentOnUpdate();
|
||||
});
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Enums\DataChangeStatus;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
@ -15,9 +14,9 @@ public function up(): void
|
||||
{
|
||||
Schema::create('data_change_requests', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignIdFor(User::class);
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->morphs('entity');
|
||||
$table->enum('status', DataChangeStatus::cases())->default(DataChangeStatus::PENDING)->comment(DataChangeStatus::comment());
|
||||
$table->enum('status', DataChangeStatus::values())->default(DataChangeStatus::PENDING->value)->comment(DataChangeStatus::comment())->index();
|
||||
$table->json('old_data')->nullable();
|
||||
$table->json('new_data');
|
||||
$table->text('change_reason')->nullable();
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Enums\DataChangeDecision;
|
||||
use App\Models\DataChangeRequest;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
@ -16,9 +14,9 @@ public function up(): void
|
||||
{
|
||||
Schema::create('data_change_reviews', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignIdFor(DataChangeRequest::class);
|
||||
$table->foreignIdFor(User::class, 'reviewer_id');
|
||||
$table->enum('decision', DataChangeDecision::cases())->comment(DataChangeDecision::comment());
|
||||
$table->foreignId('data_change_request_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('reviewer_id')->constrained('users')->cascadeOnDelete();
|
||||
$table->enum('decision', DataChangeDecision::values())->comment(DataChangeDecision::comment())->index();
|
||||
$table->text('note')->nullable();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->nullable()->useCurrentOnUpdate();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user