1
I am trying to save the information that comes from my registration form with this function:
public function postCreate()
{
$this->beforeFilter('csf', array('on' => 'post'));
$validator = Validator::make($data = Input::all(), Despesa::$rules);
if ($validator->fails())
{
return Redirect::back()->withErrors($validator)->withInput();
}
unset($data['_token']);
//dd($data);
Despesa::create($data);
return Redirect::route('admin.despesas');
}
But when I send it gives me a mistake:
Illuminate \ Database \ Eloquent \ MassAssignmentException
id
C:\xampp\htdocs\teste\Projetos\l4\bootstrap\compiled.php
{
$totallyGuarded = $this->totallyGuarded();
foreach ($this->fillableFromArray($attributes) as $key => $value) {
$key = $this->removeTableFromKey($key);
if ($this->isFillable($key)) {
$this->setAttribute($key, $value);
} elseif ($totallyGuarded) {
throw new MassAssignmentException($key);
}
}
had just added nothing in $fillable
– henrique