mardi 5 octobre 2021

Route isn't redirecting me to the correct page. It just shows me the same page but the url changes

I've made a blog template but I having trouble making the routes. When I click on the link, it should redirect me to the article page. Instead it just redirects me to the same page/same exact location. Here's my code:

<section id="about" class="ts-block" >
    <div id="cards_landscape_wrap-2">
    <div class="container">
        <div class="row">
        @foreach($blogs as $blog)
            <div class="col-lg-4">
                <a href=>
                    <div class="card-flyer"  >
                        <div class="text-box">
                            <div class="image-box ">
                                <img src="/images/blogs/" alt="" class="img-fluid rounded mx-auto d-block" width="100%"/>
                            </div>
                            <div class="text-container">
                                <h6></h6>
                                <p style="max-width: 18rem;"class="ts-opacity__50"></p>
                            </div>
                            <div class="card-footer">
                                        <span class="text-primary font-weight-bold">Read</span>
                            </div>
                        </div>
                    </div>
                </a>
            </div>
            @endforeach
        </div>
    </div>
    </div>
    </section>    

BlogController :

public function getArticles()
{
    return view('blog')->with([
        'blogs' => Blog::all(),
    ]);
}

Routes :

Route::get('/blog/', [App\Http\Controllers\BlogController::class, 'index'])->name('blog');
Route::get('blogs/','App\Http\Controllers\BlogController@getArticles')->name('blogs.show');
Route::get('/admin/blog', 'App\Http\Controllers\BlogController@getBlog')->name('admin.blog');
Route::resource('/blog','App\Http\Controllers\BlogController');

The routes that supposed to be redirecting me to another page is the 2nd one with BlogController@getArticles. The other routes are fine a have no problem.

Can someone kindly show me what I did wrong ?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire