2015-10-06 40 views
0

Laravel:Laravel:ErrorException guraded VS可填充

ErrorException在Model.php線2336:in_array()預計參數2 是數組,字符串給出

class Student extends Model 
{ 
protected $guarded = 'student_id'; 

//protected $fillable = ['full_name', 'current_grade','branch']; 
} 

我應該使用fillable?因爲當我單獨使用guarded時,它拋出這個錯誤

回答

0

即使你只有一個物品被保護,你也需要傳入一個數組。 protected $ guarded = ['student_id'];