ldc-sitemap-generator/tests/Unit/Config/ModelClass.php

28 lines
617 B
PHP
Raw Permalink Normal View History

<?php
declare(strict_types=1);
namespace Uwil\SitemapGenerator\Tests\Unit\Config;
use Illuminate\Database\Eloquent\Model;
use Spatie\Sitemap\Tags\Url;
use Uwil\SitemapGenerator\Contracts\Sitemapable;
class ModelClass extends Model implements Sitemapable
{
protected $guarded = [];
#[\Override]
public function getLocalizedUrl(string $locale): string
{
return "http://localhost/{$locale}/posts";
}
/** @return Url|string|string[] */
#[\Override]
public function toSitemapTag(): Url | string | array
{
return $this->getLocalizedUrl(app()->getLocale());
}
}