Files
numstation-web/app/Models/OnlineHelp.php

50 lines
1.0 KiB
PHP
Raw Normal View History

2023-12-22 12:35:55 +08:00
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class OnlineHelp extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'title_english',
'title_chinese',
'details_english',
'details_chinese',
'category',
'sort',
];
public function getTitleAttribute()
{
if (strtolower(app()->getLocale()) == 'zh_hk') {
return $this->title_chinese;
}
return $this->title_english;
}
public function getDetailsAttribute()
{
if (strtolower(app()->getLocale()) == 'zh_hk') {
return $this->detailss_chinese;
}
return $this->detailss_english;
}
public function getCategoryNameDisplayAttribute()
{
if ($this->category == 'faq') {
return __("FAQ");
}
return __("Online Documents");
}
}