lundi 4 octobre 2021

Laravel 8 Route not defined even route is defined

This error is comeup while i working on laravel 8

Route [product.details] not defined. (View: C:\xampp\htdocs\ecommerce\resources\views\livewire\shop-component.blade.php)

here is the route i made Route Page web.php

Route::get('/product/{slug}',DetailsComponent::class)->name('product.details');

this is line of view where i want that route View Page shop-component.balde.php

<a href="" title="">

and this one is the Details Component code


namespace App\Http\Livewire;
use Livewire\Component;

class DetailsComponent extends Component
{
    public $slug;
    Public function mount($slug){
 
        $this->slug = $slug; 
    }

    public function render()
    {
     $product = Product::where('slug', $this->slug)->first();
    return view('livewire.details-component',['product'=>$product])->layout('layouts.base'); 
    }
}

I think this php code doesnot get route of product.details at the same time i create middleware file and define a different route in it this route is working in this page but not Product.details. Kindly help me i am stuck from 1 week here




Aucun commentaire:

Enregistrer un commentaire