vendredi 3 juin 2016

Laravel how to prevent href link gets appended with current url

Let's say my project root is http://localhost/laravel-project

In the project I have navigation menu, the sample format of the link is <a href="home">home</a>" So when I click the link the url on my browser is http://localhost/laravel-project/home

I do not know why if I have another link <a href="invoice/show/1">home</a>" and the route is Route::get('/invoice/show/{id}', 'Frontend\CommonController@show');

when I click the link, the previous home link will become http://localhost/laravel-project/invoice/show/member it's supposed to be http://localhost/laravel-project/home.

The inside show method :

public function show(){

        return view('frontend.invoice', ['subaccounts' => $this->subaccounts, 'menus' => $this->menus]);
    }

I have tested it, the cause of the problem is the segments on the link invoice/show/1 if the link is only invoice then everything is fine.

Anyone knows what is wrong and how to solve this issue ?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire