format('Y-m-d H:i:s'); } protected $casts = [ 'created_at' => 'datetime:Y-m-d H:i:s', 'updated_at' => 'datetime:Y-m-d H:i:s', ]; protected function coverUrl():Attribute { return Attribute::make( get: fn($value) => $this->cover ? (Str::startsWith($this->cover, ['http://', 'https://']) ? $this->cover : Storage::url($this->cover)) : null, ); } public function scopeShow($q){ $q->where('is_enable', true); } public function scopeSort($q) { $q->orderBy('sort', 'asc') ->orderBy('created_at', 'desc'); } }