'datetime:Y-m-d H:i:s', 'updated_at' => 'datetime:Y-m-d H:i:s', 'published_at' => 'datetime:Y-m-d H:i:s', 'is_enable' => 'boolean', 'link_config' => 'json', ]; protected function picture(): Attribute { return Attribute::make( get: fn($value) => $value ? (Str::startsWith($value, ['http://', 'https://']) ? $value : Storage::url($value)) : '', ); } public function place() { return $this->belongsTo(BannerPlace::class, 'place_id'); } public function scopeSort($q) { return $q->orderBy('sort', 'desc'); } public function scopeEnable($q) { return $q->where('is_enable', 1)->where('published_at', '<=', now()); } public function modelFilter() { return BannerFilter::class; } }