adrema/app/Subactivity.php

41 lines
802 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
{
2021-08-22 19:31:20 +02:00
2021-06-23 01:05:17 +02:00
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',
],
];
}
public function activities(): BelongsToMany
{
2021-06-23 01:05:17 +02:00
return $this->belongsToMany(Activity::class);
}
2021-08-22 19:31:20 +02:00
2021-06-23 01:05:17 +02:00
}