lundi 31 janvier 2022

Opening one post instead of multiple posts

I've written a blog that's supposed to fetch data from the database. But when I click on the read more link, it keeps opening all the posts that are in the db instead of selecting only one specific post that I've clicked. Can some kindly assist me with this issue?

View

@foreach($data as $aboutus)
        <div class="col-lg">
            <img src="" class="img-fluid shadow-lg" style="">
            <p class="mt-3 text-success fw-bold fs-5 text-lg-start"></p>
            <p class="fs-6 text-lg-start"> </p>
            <p class="text-success fw-bold text-lg-start"><a href="" class="text-success text-decoration-none"></a></p>
            <!--<img src="images/hr-2.png" class="img-fluid float-start my-2">-->
        </div>
    @endforeach

Controller

public function show($id)
{
    //
    $data = AboutUs::find($id)->get();
    return view('about.show')->with(compact('data'));
    
}

Route

Route::get('/about.show/{id:title}','App\Http\Controllers\WelcomeController@show')->name('about.show');


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire