eloquent Пустое сообщение об ошибке при save (выводится только имя поля)
Primary tabs
Судя по исходному коду метода save():
// The developers may choose to place some attributes in the "fillable" array // which means only those attributes may be set through mass assignment to // the model, and all others will just get ignored for security reasons. if ($this->isFillable($key)) { $this->setAttribute($key, $value); } elseif ($totallyGuarded) { throw new MassAssignmentException($key); }
-- причина может быть в том, что у вас не определены ни защищенные ни разрешенные для массового заполнения поля.
Иногда проще всего объявить защищенные (тогда остальные будут считаться разрешенными):
class Member extends Model { protected $table = 'member'; protected $guarded = ['id']; // id не считываем в массовом режиме
Подробности: https://laravel.com/docs/5.8/eloquent#in...
- Log in to post comments
- 1516 reads