Почему грамматика :: параметризация добавляет новую строку настройки - PullRequest
1 голос
/ 18 марта 2019

В приложении laravel 5.7 я получил ошибку при сохранении, добавив новые строки настроек, я получил ошибку:

Argument 1 passed to Illuminate\Database\Grammar::parameterize() must be of the type array, string given, called in /mnt/_work_sdb8/wwwroot/lar/votes/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/Grammar.php on line 853

В моем приложении я проверяю, есть ли строка в поле Настройка таблицы по имени, если нет, то создайте ее:

                with(new self)->info( $next_votes_key,'$next_votes_key::' );
                $settings = Settings::getByName($next_votes_key)->first();
                with(new self)->info( $settings,'$settings::' );
                if ($settings === null) {
                    with(new self)->info( "INSIDE",'$::' );
                    $settings       = new Settings();
                    $settings->name = $next_votes_key;
                }
                with(new self)->info( $requestData['votes_' . $next_votes_key],'$requestData[\'votes_\' . $next_votes_key]::' );
                $settings->value      = $requestData['votes_' . $next_votes_key];
                $settings->save();

with(new self)->info that is just wrapper for 
            Debugbar::addMessage($info, $label);

Моя модель app / Settings.php очень проста и имеет только 2 заполняемых строковых поля: имя и значение:

<?php

namespace App;

use App\MyAppModel;
use App\Http\Traits\funcsTrait;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Storage;
use DB;

class Settings extends MyAppModel
{
    protected $table      = 'settings';
    protected $primaryKey = 'id';
    public $timestamps = false;


    protected $fillable = [
        'name',
        'value',
    ];
...

Почему ошибка и как ее исправить?

Спасибо!

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...