Support the ongoing development of Laravel.io →
Requests Database Forms

I am using this in my controller to grab all of the input data from the form, however only two out of the three inputs are actually inserting into their database tables, the last one just remains empty?

Controller method:

$something->create($request->all());

And the form:

{!! Form::open(['route' => 'songs.store', 'method' => 'PATCH']) !!}

<div class="form-group">
{!! Form::label('title', 'Title:') !!}
	{!! Form::text('title', null, ['class' => 'form-control', 'placeholder' => 'The name of the song']) !!}
</div>
	<br />
	
<div class="form-group">
{!! Form::label('lyrics', 'Lyrics:') !!}
	{!! Form::textarea('lyrics', null, ['class' => 'form-control', 'placeholder' => 'Lyrics that belong to the song']) !!}
</div>
	<br />
	
<div class="form-group">
{!! Form::label('slug', 'Slug:') !!}
	{!! Form::text('slug', null, ['class' => 'form-control', 'placeholder' => 'Specify a slug to use for the song']) !!}
</div>	

<div class="form-group">
	{!! Form::submit('Update records', ['class' => 'btn btn-primary']) !!}
</div>

{!! Form::close() !!}
Last updated 3 years ago.
0

create method only accepts fields you defined in the model. check the $fillable array. http://laravel.com/docs/4.2/eloquent#mass-assignment

0

astroanu said:

create method only accepts fields you defined in the model. check the $fillable array. http://laravel.com/docs/4.2/eloquent#mass-assignment

The fillable array is already set to this:

class Song extends Eloquent{

	public $timestamps = false;
	
	protected $fillable = [
		'title', 'lyrics', 'slug'
	];
}
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.