You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.3 KiB
57 lines
1.3 KiB
|
1 week ago
|
<?php
|
||
|
|
|
||
|
|
namespace App\Models;
|
||
|
|
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||
|
|
|
||
|
|
class Activity extends Model
|
||
|
|
{
|
||
|
|
use SoftDeletes;
|
||
|
|
|
||
|
|
protected $fillable = [
|
||
|
|
'code',
|
||
|
|
'title',
|
||
|
|
'activity_type_dict_item_id',
|
||
|
|
'quota',
|
||
|
|
'event_start_date',
|
||
|
|
'event_end_date',
|
||
|
|
'signup_start_date',
|
||
|
|
'signup_end_date',
|
||
|
|
'location',
|
||
|
|
'intro_html',
|
||
|
|
'progress_status',
|
||
|
|
'published',
|
||
|
|
'remark',
|
||
|
|
'sort',
|
||
|
|
];
|
||
|
|
|
||
|
|
protected $casts = [
|
||
|
|
'event_start_date' => 'date',
|
||
|
|
'event_end_date' => 'date',
|
||
|
|
'signup_start_date' => 'date',
|
||
|
|
'signup_end_date' => 'date',
|
||
|
|
'quota' => 'integer',
|
||
|
|
'progress_status' => 'integer',
|
||
|
|
'published' => 'integer',
|
||
|
|
'sort' => 'integer',
|
||
|
|
];
|
||
|
|
|
||
|
|
public function activityTypeItem(): BelongsTo
|
||
|
|
{
|
||
|
|
return $this->belongsTo(DictItem::class, 'activity_type_dict_item_id');
|
||
|
|
}
|
||
|
|
|
||
|
|
public function sessions(): HasMany
|
||
|
|
{
|
||
|
|
return $this->hasMany(ActivitySession::class);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function signups(): HasMany
|
||
|
|
{
|
||
|
|
return $this->hasMany(ActivitySignup::class);
|
||
|
|
}
|
||
|
|
}
|