adrema/app/Activity.php

38 lines
796 B
PHP
Raw Normal View History

2020-04-12 00:26:44 +02:00
<?php
namespace App;
2021-08-22 19:31:20 +02:00
use App\Nami\HasNamiField;
2022-02-12 01:06:44 +01:00
use Cviebrock\EloquentSluggable\Sluggable;
2022-03-06 02:56:03 +01:00
use Illuminate\Database\Eloquent\Factories\HasFactory;
2020-04-12 00:26:44 +02:00
use Illuminate\Database\Eloquent\Model;
2021-07-15 20:56:53 +02:00
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
2020-04-12 00:26:44 +02:00
class Activity extends Model
{
2022-03-06 02:56:03 +01:00
use HasFactory;
2021-08-22 19:31:20 +02:00
use HasNamiField;
2022-02-12 01:06:44 +01:00
use Sluggable;
2021-08-22 19:31:20 +02:00
2021-08-23 01:59:53 +02:00
public $fillable = ['is_try', 'is_member', 'name', 'is_filterable', 'nami_id'];
2020-04-12 00:26:44 +02:00
public $timestamps = false;
public $casts = [
2022-03-11 20:19:17 +01:00
'nami_id' => 'integer',
2020-04-12 00:26:44 +02:00
];
2022-02-12 01:06:44 +01:00
public function sluggable(): array
{
return [
'slug' => [
'source' => 'name',
],
];
}
2022-03-11 20:19:17 +01:00
public function subactivities(): BelongsToMany
{
2021-06-23 01:05:17 +02:00
return $this->belongsToMany(Subactivity::class);
2020-04-12 00:26:44 +02:00
}
}