mardi 22 mars 2022

Pass date in url in Laravel

I have this Link in my view

 <a href="">
 Link
 </a>

when i click on this link this url is called

detail?id=2&date=03-22-2022

getting this error :

Could not parse '03-22-2022': DateTime::__construct(): Failed to parse time string (03-22-2022) at position 0 (0): Unexpected character

but if my url is

detail?id=1&date=03%2F22%2F2022

then it is working how can i urlencode in laravel

Controller:

public function Detail(Request $request)
    {
         
        $start_date=date('Y-m-d H:i:s', strtotime($request->date));
    }

Thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire