adrema/app/Subactivity.php

42 lines
855 B
PHP
Raw Normal View History

2021-06-23 01:05:17 +02:00
<?php
namespace App;
2021-08-22 19:31:20 +02:00
use App\Nami\HasNamiField;
use Cviebrock\EloquentSluggable\Sluggable;
2021-06-23 01:05:17 +02:00
use Illuminate\Database\Eloquent\Factories\HasFactory;
2021-08-22 19:31:20 +02:00
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
2021-06-23 01:05:17 +02:00
class Subactivity extends Model
{
use HasFactory;
2021-08-22 19:31:20 +02:00
use HasNamiField;
use Sluggable;
2021-06-23 01:05:17 +02:00
public $fillable = ['is_age_group', 'is_filterable', 'slug', 'name', 'nami_id'];
2021-06-23 01:05:17 +02:00
public $timestamps = false;
2021-08-22 19:31:20 +02:00
public $casts = [
'is_age_group' => 'boolean',
];
public function sluggable(): array
{
return [
'slug' => [
'source' => 'name',
],
];
}
2023-02-17 18:57:11 +01:00
/**
* @return BelongsToMany<Activity>
*/
2021-08-22 19:31:20 +02:00
public function activities(): BelongsToMany
{
2021-06-23 01:05:17 +02:00
return $this->belongsToMany(Activity::class);
}
}