I am trying to do delete the post on selected date but it's not working. However there is not any error, even checked with dd($request)
it's my controller,
public function save(Request $request)
{
$this->validate($request, [
'content' =>'required',
'start_date'=>'required',
'exp_date'=>'required',
]);
$save = [
'content'=>$request->content,
'start_date'=>Carbon::parse(strtotime($request->start_date))->format('Y-m-d'),
'exp_date'=>Carbon::parse(strtotime($request->exp_date))->format('Y-m-d'),
];
letter::create($save);
$start_date = Carbon::parse($request->start_date)
->startOfDay()
->toDateTimeString();
$exp_date= Carbon::parse($request->exp_date)
->endOfDay()
->toDateTimeString();
letter::whereBetween('id', [$start_date, $exp_date])->get();
return redirect()->back();
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire