50 lines
1.0 KiB
PHP
50 lines
1.0 KiB
PHP
|
|
<?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");
|
||
|
|
}
|
||
|
|
}
|