Sindbad~EG File Manager

Current Path : /home/zada/www/app/Models/
Upload File :
Current File : /home/zada/www/app/Models/Faq.php

<?php

namespace App\Models;

use App;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Faq extends Model
{
    use HasFactory;
    protected $with = ['faq_translations'];
    
    public function getTranslation($field = '', $lang = false)
    {
        $lang = $lang == false ? App::getLocale() : $lang;
        $faq_translation = $this->faq_translations->where('lang', $lang)->first();
        return $faq_translation != null ? $faq_translation->$field : $this->$field;
    }

    public function faq_translations()
    {
        return $this->hasMany(FaqTranslation::class);
    }
}

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists (>^ω^<)看过哭02teddd(>^ω^<)看过哭02teddd