mirror of
https://github.com/brian8544/turtle-wow.git
synced 2025-01-03 13:24:35 +00:00
46 lines
994 B
PHP
46 lines
994 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class BugTrackerPriority extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'name_en',
|
|
'name_zh_cn',
|
|
'description_en',
|
|
'description_zh_cn',
|
|
'color',
|
|
'icon'
|
|
];
|
|
|
|
public function __get($key)
|
|
{
|
|
if (strpos($key, 'name_localized') === 0) {
|
|
$locale = app()->getLocale();
|
|
|
|
$localizedKey = 'name_' . $locale;
|
|
|
|
if (in_array($localizedKey, $this->fillable)) {
|
|
return $this->$localizedKey;
|
|
}
|
|
}
|
|
|
|
if (strpos($key, 'description_localized') === 0) {
|
|
$locale = app()->getLocale();
|
|
|
|
$localizedKey = 'description_' . $locale;
|
|
|
|
if (in_array($localizedKey, $this->fillable)) {
|
|
return $this->$localizedKey;
|
|
}
|
|
}
|
|
|
|
return parent::__get($key);
|
|
}
|
|
}
|