feat(event): add date reschedule history
This commit is contained in:
@@ -86,6 +86,18 @@ class EventDate extends Model
|
||||
return $this->hasMany(self::class, 'rescheduled_to_event_date_id');
|
||||
}
|
||||
|
||||
/** @return HasMany<EventDateReschedule, $this> */
|
||||
public function rescheduleHistory(): HasMany
|
||||
{
|
||||
return $this->hasMany(EventDateReschedule::class, 'source_event_date_id');
|
||||
}
|
||||
|
||||
/** @return HasMany<EventDateReschedule, $this> */
|
||||
public function destinationRescheduleHistory(): HasMany
|
||||
{
|
||||
return $this->hasMany(EventDateReschedule::class, 'destination_event_date_id');
|
||||
}
|
||||
|
||||
/** @return HasMany<Variant, $this> */
|
||||
public function variants(): HasMany
|
||||
{
|
||||
|
||||
58
app/Domains/Event/Models/EventDateReschedule.php
Normal file
58
app/Domains/Event/Models/EventDateReschedule.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Event\Models;
|
||||
|
||||
use App\Domains\Auth\Models\User;
|
||||
use App\Domains\Tenant\Models\Tenant;
|
||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
#[Fillable([
|
||||
'tenant_code',
|
||||
'source_event_date_id',
|
||||
'destination_event_date_id',
|
||||
'created_by_user_id',
|
||||
'previous_date',
|
||||
'new_date',
|
||||
])]
|
||||
class EventDateReschedule extends Model
|
||||
{
|
||||
public $timestamps = false;
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'source_event_date_id' => 'integer',
|
||||
'destination_event_date_id' => 'integer',
|
||||
'created_by_user_id' => 'integer',
|
||||
'previous_date' => 'date:Y-m-d',
|
||||
'new_date' => 'date:Y-m-d',
|
||||
'created_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
/** @return BelongsTo<Tenant, $this> */
|
||||
public function tenant(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Tenant::class, 'tenant_code', 'codigo');
|
||||
}
|
||||
|
||||
/** @return BelongsTo<EventDate, $this> */
|
||||
public function sourceEventDate(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(EventDate::class, 'source_event_date_id');
|
||||
}
|
||||
|
||||
/** @return BelongsTo<EventDate, $this> */
|
||||
public function destinationEventDate(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(EventDate::class, 'destination_event_date_id');
|
||||
}
|
||||
|
||||
/** @return BelongsTo<User, $this> */
|
||||
public function createdBy(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'created_by_user_id')->withTrashed();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user