adrema/app/Subactivity.php

43 lines
893 B
PHP
Raw Permalink 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',
2023-03-07 00:27:10 +01:00
'is_filterable' => 'boolean',
2021-08-22 19:31:20 +02:00
];
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);
}
}