fedi-feed-router/app/Models/Language.php

53 lines
1.1 KiB
PHP
Raw Permalink Normal View History

2025-07-05 18:26:04 +02:00
<?php
namespace App\Models;
2025-07-06 01:35:59 +02:00
use Database\Factories\LanguageFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
2025-07-05 18:26:04 +02:00
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
class Language extends Model
{
2025-07-06 01:35:59 +02:00
/** @use HasFactory<LanguageFactory> */
use HasFactory;
2025-07-05 18:26:04 +02:00
protected $fillable = [
'short_code',
'name',
'native_name',
'is_active'
];
protected $casts = [
'is_active' => 'boolean'
];
2025-07-07 00:51:32 +02:00
/**
* @return BelongsToMany<PlatformInstance, $this>
*/
2025-07-05 18:26:04 +02:00
public function platformInstances(): BelongsToMany
{
return $this->belongsToMany(PlatformInstance::class)
->withPivot(['platform_language_id', 'is_default'])
->withTimestamps();
}
2025-07-07 00:51:32 +02:00
/**
* @return HasMany<PlatformChannel, $this>
*/
2025-07-05 18:26:04 +02:00
public function platformChannels(): HasMany
{
return $this->hasMany(PlatformChannel::class);
}
2025-07-07 00:51:32 +02:00
/**
* @return HasMany<Feed, $this>
*/
2025-07-05 18:26:04 +02:00
public function feeds(): HasMany
{
return $this->hasMany(Feed::class);
}
}