diff --git a/app/Models/Owned.php b/app/Models/Owned.php index 59f63b2..4d3db35 100644 --- a/app/Models/Owned.php +++ b/app/Models/Owned.php @@ -5,6 +5,7 @@ use App\Traits\Categorizable; use App\Traits\Imageable; use App\Traits\Ownable; +use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; @@ -28,6 +29,15 @@ class Owned extends Model // injected by trait: categories (many-to-many polymorphic) + /* --------------------------------------------------------------------------------- url ---- */ + + protected function url() : Attribute + { + return Attribute::make( + get: fn () => "/{$this->slug}", + ); + } + /* ------------------------------------------------------------------------------- store ---- */ public static function store(array $validated) : static