forked from eatvio/eatvio-infra
Merge branch 'main' of ssh://gitea.office.local:222/alex_chevski/eatvio into alex_chevski-main
This commit is contained in:
@@ -11,13 +11,37 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Laracasts\Presenter\PresentableTrait;
|
||||
use Spatie\Sluggable\HasSlug;
|
||||
use Spatie\Sluggable\SlugOptions;
|
||||
|
||||
class Plan extends Model implements Viewable
|
||||
{
|
||||
use HasFactory;
|
||||
use HasSlug;
|
||||
use InteractsWithViews;
|
||||
use PresentableTrait;
|
||||
|
||||
public function getSlugOptions(): SlugOptions
|
||||
{
|
||||
return SlugOptions::create()
|
||||
->generateSlugsFrom(['name'] )
|
||||
->saveSlugsTo('slug')
|
||||
// ->slugsShouldBeNoLongerThan(20)
|
||||
->usingSeparator('_');
|
||||
// ->usingLanguage('ru')
|
||||
// ->doNotGenerateSlugsOnUpdate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the route key for the model.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRouteKeyName()
|
||||
{
|
||||
return 'slug';
|
||||
}
|
||||
|
||||
protected $withCount = [
|
||||
'likes',
|
||||
'comments',
|
||||
|
||||
Reference in New Issue
Block a user