Use a migration to change make your column nullable, or define a default date (in the db or in your strore function)
Apr 21, 2022
3
Level 1
Date Range Picker
I trying to send a request to my database is given me this error mssage
Integrity constraint violation: 1048 Column 'end_date' cannot be null (SQL: insert into porfolios (job_title, project_name, user_id, content, end_date, start_date, featured_img, published_at, updated_at, created_at)
look at my code public function store(StorePorfolioRequest $request){
$porfolio = new Porfolio;
$porfolio->job_title = $request->job_title;
$porfolio->project_name = $request->project_name;
$porfolio->user_id = Auth::user()->id;
$porfolio->content = $request->content;
$porfolio->end_date = $request->end_date;
$porfolio->start_date = $request->start_date;
$porfolio->featured_img = $this->upload_image($request);
$porfolio->published_at = $request->filled('published') ? Carbon::now() : null;
$porfolio->save();
return response()->json('ok', 201);
}
Please or to participate in this conversation.