i trying add new item object error:
here code:
$q = question::where('id',$id -> id)->first(); $q[]=$q->push('test',5); dd($q); here return:
missing argument 2 illuminate\database\eloquent\model::setattribute(), called in /home/client/public_html/storage/framework/compiled.php on line 10231 , defined
any idea how fix this?
according laravel doc,
sometimes may wish save not model, of relationships. so, may use
pushmethod
therefore push() try presist attribute , fail because doen't exist in model table. instead of using push(), use dynamic attributes:
$q->randomattribute = "value"; i not sure how planning use attribute later, maybe can give better answer.
Comments
Post a Comment