Files
timebank-cc-public/app/Models/Language.php
Ronald Huynen 2547717edb Initial commit
2026-03-23 21:37:59 +01:00

45 lines
827 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Language extends Model
{
use HasFactory;
protected $fillable = [
'name',
'lang_code',
'flag'
];
/**
* Get all users that are assigned to this language.
*/
public function users()
{
return $this->morphedByMany(User::class, 'languagable');
}
/**
* Get all organizations that are assigned to this language.
*/
public function organizations()
{
return $this->morphedByMany(Organization::class, 'languagable');
}
/**
* Get all posts that are assigned to this language.
*/
public function posts()
{
return $this->morphedByMany(Post::class, 'languagable');
}
}