Fix minore
This commit is contained in:
parent
08b6bb5556
commit
add94f9bd0
|
@ -77,8 +77,8 @@ trait RecordTrait
|
||||||
{
|
{
|
||||||
if ($this->id) {
|
if ($this->id) {
|
||||||
// Lingue aggiuntive disponibili
|
// Lingue aggiuntive disponibili
|
||||||
$langs = Locale::All();
|
$langs = Locale::All()->toArray();
|
||||||
$other_langs = array_diff($langs, [Locale::getDefault()]);
|
$other_langs = array_diff($langs, [Locale::getDefault()->id]);
|
||||||
|
|
||||||
// Popolo inizialmente i campi traducibili o allineo quelli uguali
|
// Popolo inizialmente i campi traducibili o allineo quelli uguali
|
||||||
foreach ($this->getTranslatedFields() as $field) {
|
foreach ($this->getTranslatedFields() as $field) {
|
||||||
|
@ -117,7 +117,7 @@ trait RecordTrait
|
||||||
*/
|
*/
|
||||||
public function setTranslation($field, $value, $id_lang = null)
|
public function setTranslation($field, $value, $id_lang = null)
|
||||||
{
|
{
|
||||||
$id_lang ??= \Models\Locale::getDefault()->id;
|
$id_lang ??= Locale::getDefault()->id;
|
||||||
$table = database()->table($this->table.'_lang');
|
$table = database()->table($this->table.'_lang');
|
||||||
|
|
||||||
$translated = $table
|
$translated = $table
|
||||||
|
@ -143,7 +143,7 @@ trait RecordTrait
|
||||||
*/
|
*/
|
||||||
public function getTranslation($field, $id_lang = null)
|
public function getTranslation($field, $id_lang = null)
|
||||||
{
|
{
|
||||||
$id_lang ??= \Models\Locale::getDefault()->id;
|
$id_lang ??= Locale::getDefault()->id;
|
||||||
return database()->table($this->table.'_lang')
|
return database()->table($this->table.'_lang')
|
||||||
->select($field)
|
->select($field)
|
||||||
->where('id_record', '=', $this->id)
|
->where('id_record', '=', $this->id)
|
||||||
|
@ -154,7 +154,7 @@ trait RecordTrait
|
||||||
|
|
||||||
public function getByField($field, $value, $id_lang = null)
|
public function getByField($field, $value, $id_lang = null)
|
||||||
{
|
{
|
||||||
$id_lang ??= \Models\Locale::getDefault()->id;
|
$id_lang ??= Locale::getDefault()->id;
|
||||||
return database()->table($this->table.'_lang')
|
return database()->table($this->table.'_lang')
|
||||||
->select('id_record')
|
->select('id_record')
|
||||||
->where($field, '=', $value)
|
->where($field, '=', $value)
|
||||||
|
|
Loading…
Reference in New Issue