Reputation: 147
I'm adding data to a DB table and some of the data is going in and some is not. I've recheck the field names to make sure they are correct.
The result of dd($request) is below:
[
Controller:
public function store(Request $request)
{
//
Donation::create($request->all());
return redirect()->action('DonationController@index');
}
[
Upvotes: 0
Views: 83
Reputation: 8750
Laravel has a security mechanism whereby you need to specifically define which fields you want to allow to be filled, in this case mass assignable. More info here
So in this case, in your Donation
model, please ensure that the fields have been defined in the $fillable
array as such
protected $fillable = ['notes', 'another_field', 'another_field_2'];
Upvotes: 3