| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- namespace App\Models;
- use App\Constants\Util;
- use Illuminate\Database\Eloquent\Relations\HasMany;
- /**
- * @property string $title
- * @property string sub_title
- * @property string detail_image
- * @property string start_time
- * @property string end_time
- * @property string status
- *
- */
- class ActivityReward extends BaseModel
- {
- const STATUS_UP = 1;
- const STATUS_DOWN = 0;
- protected $table = 'activity_rewards';
- protected $fillable = ['title', 'sub_title', 'detail_image', 'start_time', 'end_time', 'status'];
- public function activityUser(): HasMany
- {
- return $this->hasMany(ActivityUser::class, 'activity_id', 'id');
- }
- protected function getDetailImageAttribute($value)
- {
- return Util::ensureUrl($value);
- }
- protected function getStartTimeAttribute($value): string
- {
- return date('Y-m-d', $value);
- }
- protected function getEndTimeAttribute($value): string
- {
- return date('Y-m-d', $value);
- }
- }
|