the error :SQLSTATE[HY000]: General error: 1364 Field 'description' doesn't have a default value (SQL: insert into projects
(title
, updated_at
, created_at
) values (projet 5, 2019-03-01 22:13:19, 2019-03-01 22:13:19))
class ProjectController.php
public function create()
{
return view('projects.create');
}
public function store()
{
//dd(request()->all());
Project::create(request(['title','description']));
return redirect('/projects');
}
class Project.php
class Project extends Model
{
protected $fillable=[
'title','description'
];
}
web.php
Route::resource('projects','ProjectsController');
Field 'description' doesn't have a default value
you should probabaly make that column nullable
Either make the description column nullable (default null or empty string) or $description = request()->get('description','fallbackVal');
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community