'array']; protected static function booted() { self::language(); static::saving(function (Banner $banner) { if (empty($banner->start_time)) { $banner->start_time = Carbon::now()->toDateTimeString(); } }); } public function cover_resource() { return $this->belongsTo(Resource::class, 'cover', 'id')->select(['id', 'url', 'path']); } public function scopeActive($query) { $now = Carbon::now(); return $query->where('start_time', '<=', $now)->where('end_time', '>=', $now); } }