descom/descommarket-seo

1.1.0 2024-04-18 14:51 UTC

This package is auto-updated.

Last update: 2024-09-18 15:52:15 UTC


README

tests analyze

安装

composer require descom-es/descommarket-seo
php artisan migrate

使用

配置模型以使用 SEO

在需要 SEO 的模型中添加特质 DescomMarket\Seo\Traits

将 SEO 添加到您的模型

    $product->addMeta('title', 'new title to product');
    $product->addMeta('description', 'Meta description to product');

将 MetaResource 获取到您的 API

    public function toArray($request)
    {
        return [
            'id' => $this->id,
            'meta' => $this->whenLoaded('meta', new MetaResource($this->meta)),
        ];
    }