samedi 17 août 2019

Displaying category url with only name laravel

I'm trying to display category url with name and not id , eg. http://567.0.0.1:23/category/Women. In categories table, there is Id, and name columns also in products table there is category_id column. So far the url displays empty category, how can I make it display url with name?

Route

 Route::get('/category/{name}', 'HomeController@showCates'); 

Href

 `<a href="http://567.0.0.1:23/category/Women"></a>`

Controller

    public function showCates($id)
    {
    $category_products=product::where('category_id',$id)->get();
    $id_ =$id;
    return     view('front.category_list_pro',compact('category_products', 'id_'));
    }



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

Aucun commentaire:

Enregistrer un commentaire