classify admin
This commit is contained in:
42
app/Models/VerificationFieldsTranslation.php
Normal file
42
app/Models/VerificationFieldsTranslation.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Throwable;
|
||||
|
||||
class VerificationFieldsTranslation extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'verification_fields_translations';
|
||||
protected $fillable = [
|
||||
'verification_field_id',
|
||||
'language_id',
|
||||
'name',
|
||||
'value',
|
||||
];
|
||||
/**
|
||||
* Get the custom field that owns this translation.
|
||||
*/
|
||||
public function verificationfield()
|
||||
{
|
||||
return $this->belongsTo(VerificationField::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the language for this translation.
|
||||
*/
|
||||
public function language()
|
||||
{
|
||||
return $this->belongsTo(Language::class);
|
||||
}
|
||||
|
||||
public function getValueAttribute($value) {
|
||||
try {
|
||||
return array_values(json_decode($value, true, 512, JSON_THROW_ON_ERROR));
|
||||
} catch (Throwable) {
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user