Answer the question
In order to leave comments, you need to log in
How to write scope in a model to select a field by condition?
Hello guys!
Actually, there is a table
there is a table:
=========================================
| id | title_ru | title_en | title_kz |
=========================================
$title = 'title_' . LaravelLocalization::getCurrentLocale();
($record->$title) ? $record->$title : $record->title_ru;
$record->title
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question