adrema/app/Subactivity.php

57 lines
1.1 KiB
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;
2024-09-22 17:32:29 +02:00
use Database\Factories\UserFactory;
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
{
2024-09-22 17:32:29 +02:00
/** @use HasFactory<UserFactory> */
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
2023-09-19 20:14:52 +02:00
/**
* @var array<int, string>
*/
public $fillable = ['is_age_group', 'is_filterable', 'slug', 'name', 'nami_id'];
2021-06-23 01:05:17 +02:00
2023-09-19 20:14:52 +02:00
/**
* @var bool
*/
2021-06-23 01:05:17 +02:00
public $timestamps = false;
2023-09-19 20:14:52 +02:00
/**
* @var array<string, string>
*/
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
];
2023-09-19 20:14:52 +02:00
/**
* @return array<string, array{source: string}>
*/
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);
}
}