mercredi 24 juillet 2019

How to delete post automatically from home page in laravel

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();

}



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2MbMrgO
via IFTTT

Aucun commentaire:

Enregistrer un commentaire