JFIF  x x C         C     "        } !1AQa "q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz        w !1AQ aq"2B #3Rbr{ gilour

File "UserType.php"

Full Path: /var/www/laravel_filter/app/Models/UserType.php
File size: 714 bytes
MIME-type: text/x-php
Charset: utf-8

<?php

namespace App\Models;

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

class UserType extends Model
{
    use HasFactory;

    protected $appends = ['name'];

    protected $hidden = ['front_translate'];

    public function translate(){
        return $this->belongsTo(UserTypeTranslation::class, 'id', 'user_type_id')->where('lang_code', admin_lang());
    }

    public function front_translate(){
        return $this->belongsTo(UserTypeTranslation::class, 'id', 'user_type_id')->where('lang_code', front_lang());
    }

    public function getNameAttribute()
    {
        return $this->front_translate->name;
    }
}