0
爲什麼第一個代碼有效,但第二個代碼不起作用?Laravel上的兩個版本
第一:
$user = new User;
$user->name = Input::get('name');
$user->email = Input::get('email');
$user->password = Hash::make(Input::get('password'));
$user->save();
二:
User::create(array(
'name' => Input::get('name'),
'email' => Input::get('email'),
'password' => Hash::make(Input::get('password')),
));
錯誤消息:
Illuminate \ Database \ Eloquent \ MassAssignmentException
name
'fillable'作爲白名單或'guarded'作爲黑名單 –
我的鼠標搞砸了......雙擊了upvote on your comment ...對不起,想把你的評論+1給deczo – lagbox