href returning another URLConvert from MySQL datetime to another format with PHPSaving image from PHP URLCan't use method return value in write contextIs there a function to make a copy of a PHP array to another?Returning JSON from a PHP ScriptGet the full URL in PHPLaravel: Get base urlHow to avoid displaying jos-Error in contact categories?Laravel routes in Shared Hosting not works properlyBuilding a Dynamic Menu Based On Laravel 5 Models & Blade Templates

New Site Design!

Why did Robert pick unworthy men for the White Cloaks?

How long would it take for sucrose to undergo hydrolysis in boiling water?

Would a bit of grease on overhead door cables or bearings cause the springs to break?

What does the "titan" monster tag mean?

Can a 40amp breaker be used safely and without issue with a 40amp device on 6AWG wire?

Dedicated bike GPS computer over smartphone

I received a gift from my sister who just got back from

My players want to use called-shots on Strahd

Why are backslashes included in this shell script?

SFDX force:org:clone not working

How can I find out about the game world without meta-influencing it?

Why is Skinner so awkward in Hot Fuzz?

Integrate without expansion?

Do Veracrypt encrypted volumes have any kind of brute force protection?

Why does there seem to be an extreme lack of public trashcans in Taiwan?

Should I move out from my current apartment before the contract ends to save more money?

The best in flight meal option for those suffering from reflux

How to represent jealousy in a cute way?

Is it a good security practice to force employees hide their employer to avoid being targeted?

Short story about psychologist analyzing demon

Opposite of "Concerto Grosso"?

Should I worry about having my credit pulled multiple times while car shopping?

Why is it bad to use your whole foot in rock climbing



href returning another URL


Convert from MySQL datetime to another format with PHPSaving image from PHP URLCan't use method return value in write contextIs there a function to make a copy of a PHP array to another?Returning JSON from a PHP ScriptGet the full URL in PHPLaravel: Get base urlHow to avoid displaying jos-Error in contact categories?Laravel routes in Shared Hosting not works properlyBuilding a Dynamic Menu Based On Laravel 5 Models & Blade Templates






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















After I click in the menu navigation (for exemple href='home') when i am in the view .../public/single/1 they send me to .../public/single/home and not .../public/home



Here is my code:



MENU LIST



<div class="header_content d-flex flex-row align-items-center justify-content-start">
<div class="logo"><a href="#"><span>m</span>a <span> B</span>ibli<span>o</span></a></div>
<nav class="main_nav">
<ul class="d-flex flex-row align-items-start justify-content-start">
<li class="$home"><a href="home">Acceuil</a></li>
<li class="$about"><a href="about">About us</a></li>
<li class="$listing"><a href="listing">Produits</a></li>
<li class="$blog"><a href="blog">Nouveauté</a></li>
<li class="$contact"><a href="contact">Contactez nous!</a></li>
</ul>
</nav>
<div class="submit ml-auto"><a href="#">Recherche >></a></div>
<div class="hamburger ml-auto"><i class="fa fa-bars" aria-hidden="true"></i></div>
</div>
</div>


WEB.PHP



Route::get('/single/id','AnnonceController@annonce');
Route::get('/home','PagesController@home');
Route::resource('home','AnnonceController');


And this is my controller:



public function annonce($id) 
$annonce = DB::table('annonce')
->join('article', 'annonce.ID_ANNONCE', '=', 'article.ID_ANNONCE')
->join('photo_articles', 'photo_articles.ID_ARTICLE', '=', 'article.ID_ARTICLE')
->select('annonce.*', 'article.NOM_ARTICLE','PHOTO_ARTICLE')
->where('annonce.ID_ANNONCE',$id)
->get();

return view('single')->with('annonce',$annonce);










share|improve this question
























  • That is how relative URLs work. See laravel.com/docs/5.8/urls for how to generate accurate URLs for your app

    – Phil
    Mar 25 at 4:26

















0















After I click in the menu navigation (for exemple href='home') when i am in the view .../public/single/1 they send me to .../public/single/home and not .../public/home



Here is my code:



MENU LIST



<div class="header_content d-flex flex-row align-items-center justify-content-start">
<div class="logo"><a href="#"><span>m</span>a <span> B</span>ibli<span>o</span></a></div>
<nav class="main_nav">
<ul class="d-flex flex-row align-items-start justify-content-start">
<li class="$home"><a href="home">Acceuil</a></li>
<li class="$about"><a href="about">About us</a></li>
<li class="$listing"><a href="listing">Produits</a></li>
<li class="$blog"><a href="blog">Nouveauté</a></li>
<li class="$contact"><a href="contact">Contactez nous!</a></li>
</ul>
</nav>
<div class="submit ml-auto"><a href="#">Recherche >></a></div>
<div class="hamburger ml-auto"><i class="fa fa-bars" aria-hidden="true"></i></div>
</div>
</div>


WEB.PHP



Route::get('/single/id','AnnonceController@annonce');
Route::get('/home','PagesController@home');
Route::resource('home','AnnonceController');


And this is my controller:



public function annonce($id) 
$annonce = DB::table('annonce')
->join('article', 'annonce.ID_ANNONCE', '=', 'article.ID_ANNONCE')
->join('photo_articles', 'photo_articles.ID_ARTICLE', '=', 'article.ID_ARTICLE')
->select('annonce.*', 'article.NOM_ARTICLE','PHOTO_ARTICLE')
->where('annonce.ID_ANNONCE',$id)
->get();

return view('single')->with('annonce',$annonce);










share|improve this question
























  • That is how relative URLs work. See laravel.com/docs/5.8/urls for how to generate accurate URLs for your app

    – Phil
    Mar 25 at 4:26













0












0








0








After I click in the menu navigation (for exemple href='home') when i am in the view .../public/single/1 they send me to .../public/single/home and not .../public/home



Here is my code:



MENU LIST



<div class="header_content d-flex flex-row align-items-center justify-content-start">
<div class="logo"><a href="#"><span>m</span>a <span> B</span>ibli<span>o</span></a></div>
<nav class="main_nav">
<ul class="d-flex flex-row align-items-start justify-content-start">
<li class="$home"><a href="home">Acceuil</a></li>
<li class="$about"><a href="about">About us</a></li>
<li class="$listing"><a href="listing">Produits</a></li>
<li class="$blog"><a href="blog">Nouveauté</a></li>
<li class="$contact"><a href="contact">Contactez nous!</a></li>
</ul>
</nav>
<div class="submit ml-auto"><a href="#">Recherche >></a></div>
<div class="hamburger ml-auto"><i class="fa fa-bars" aria-hidden="true"></i></div>
</div>
</div>


WEB.PHP



Route::get('/single/id','AnnonceController@annonce');
Route::get('/home','PagesController@home');
Route::resource('home','AnnonceController');


And this is my controller:



public function annonce($id) 
$annonce = DB::table('annonce')
->join('article', 'annonce.ID_ANNONCE', '=', 'article.ID_ANNONCE')
->join('photo_articles', 'photo_articles.ID_ARTICLE', '=', 'article.ID_ARTICLE')
->select('annonce.*', 'article.NOM_ARTICLE','PHOTO_ARTICLE')
->where('annonce.ID_ANNONCE',$id)
->get();

return view('single')->with('annonce',$annonce);










share|improve this question
















After I click in the menu navigation (for exemple href='home') when i am in the view .../public/single/1 they send me to .../public/single/home and not .../public/home



Here is my code:



MENU LIST



<div class="header_content d-flex flex-row align-items-center justify-content-start">
<div class="logo"><a href="#"><span>m</span>a <span> B</span>ibli<span>o</span></a></div>
<nav class="main_nav">
<ul class="d-flex flex-row align-items-start justify-content-start">
<li class="$home"><a href="home">Acceuil</a></li>
<li class="$about"><a href="about">About us</a></li>
<li class="$listing"><a href="listing">Produits</a></li>
<li class="$blog"><a href="blog">Nouveauté</a></li>
<li class="$contact"><a href="contact">Contactez nous!</a></li>
</ul>
</nav>
<div class="submit ml-auto"><a href="#">Recherche >></a></div>
<div class="hamburger ml-auto"><i class="fa fa-bars" aria-hidden="true"></i></div>
</div>
</div>


WEB.PHP



Route::get('/single/id','AnnonceController@annonce');
Route::get('/home','PagesController@home');
Route::resource('home','AnnonceController');


And this is my controller:



public function annonce($id) 
$annonce = DB::table('annonce')
->join('article', 'annonce.ID_ANNONCE', '=', 'article.ID_ANNONCE')
->join('photo_articles', 'photo_articles.ID_ARTICLE', '=', 'article.ID_ARTICLE')
->select('annonce.*', 'article.NOM_ARTICLE','PHOTO_ARTICLE')
->where('annonce.ID_ANNONCE',$id)
->get();

return view('single')->with('annonce',$annonce);







php laravel






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 25 at 4:24









Udhav Sarvaiya

2,82392132




2,82392132










asked Mar 25 at 1:53









Othmane MessaoudOthmane Messaoud

114




114












  • That is how relative URLs work. See laravel.com/docs/5.8/urls for how to generate accurate URLs for your app

    – Phil
    Mar 25 at 4:26

















  • That is how relative URLs work. See laravel.com/docs/5.8/urls for how to generate accurate URLs for your app

    – Phil
    Mar 25 at 4:26
















That is how relative URLs work. See laravel.com/docs/5.8/urls for how to generate accurate URLs for your app

– Phil
Mar 25 at 4:26





That is how relative URLs work. See laravel.com/docs/5.8/urls for how to generate accurate URLs for your app

– Phil
Mar 25 at 4:26












2 Answers
2






active

oldest

votes


















1














It's happening because you giving href='home' which will add to your current URL , which means you are on single/1(route parameter) and when you click it will become single/home(parameter).



so give the full path.



I suggest you should use the route function of laravel and also give the name to your route like below



Route::get('/home','PagesController@home')->name('myhome');
see Documentation for naming route.



then call this in your blade like this
route('myhome')






share|improve this answer






























    0














    You return statement should be like this return view('single',['id' => $id])->with('annonce',$annonce);



    Note: Please use relationship in Laravel instead of DB::table



    public function annonce($id) 
    $annonce = DB::table('annonce')
    ->join('article', 'annonce.ID_ANNONCE', '=', 'article.ID_ANNONCE')
    ->join('photo_articles', 'photo_articles.ID_ARTICLE', '=', 'article.ID_ARTICLE')
    ->select('annonce.*', 'article.NOM_ARTICLE','PHOTO_ARTICLE')
    ->where('annonce.ID_ANNONCE',$id)
    ->get();

    return view('single',['id' => $id])->with('annonce',$annonce);






    share|improve this answer























      Your Answer






      StackExchange.ifUsing("editor", function ()
      StackExchange.using("externalEditor", function ()
      StackExchange.using("snippets", function ()
      StackExchange.snippets.init();
      );
      );
      , "code-snippets");

      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "1"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55330369%2fhref-returning-another-url%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      1














      It's happening because you giving href='home' which will add to your current URL , which means you are on single/1(route parameter) and when you click it will become single/home(parameter).



      so give the full path.



      I suggest you should use the route function of laravel and also give the name to your route like below



      Route::get('/home','PagesController@home')->name('myhome');
      see Documentation for naming route.



      then call this in your blade like this
      route('myhome')






      share|improve this answer



























        1














        It's happening because you giving href='home' which will add to your current URL , which means you are on single/1(route parameter) and when you click it will become single/home(parameter).



        so give the full path.



        I suggest you should use the route function of laravel and also give the name to your route like below



        Route::get('/home','PagesController@home')->name('myhome');
        see Documentation for naming route.



        then call this in your blade like this
        route('myhome')






        share|improve this answer

























          1












          1








          1







          It's happening because you giving href='home' which will add to your current URL , which means you are on single/1(route parameter) and when you click it will become single/home(parameter).



          so give the full path.



          I suggest you should use the route function of laravel and also give the name to your route like below



          Route::get('/home','PagesController@home')->name('myhome');
          see Documentation for naming route.



          then call this in your blade like this
          route('myhome')






          share|improve this answer













          It's happening because you giving href='home' which will add to your current URL , which means you are on single/1(route parameter) and when you click it will become single/home(parameter).



          so give the full path.



          I suggest you should use the route function of laravel and also give the name to your route like below



          Route::get('/home','PagesController@home')->name('myhome');
          see Documentation for naming route.



          then call this in your blade like this
          route('myhome')







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 25 at 5:02









          Karan SadanaKaran Sadana

          77938




          77938























              0














              You return statement should be like this return view('single',['id' => $id])->with('annonce',$annonce);



              Note: Please use relationship in Laravel instead of DB::table



              public function annonce($id) 
              $annonce = DB::table('annonce')
              ->join('article', 'annonce.ID_ANNONCE', '=', 'article.ID_ANNONCE')
              ->join('photo_articles', 'photo_articles.ID_ARTICLE', '=', 'article.ID_ARTICLE')
              ->select('annonce.*', 'article.NOM_ARTICLE','PHOTO_ARTICLE')
              ->where('annonce.ID_ANNONCE',$id)
              ->get();

              return view('single',['id' => $id])->with('annonce',$annonce);






              share|improve this answer



























                0














                You return statement should be like this return view('single',['id' => $id])->with('annonce',$annonce);



                Note: Please use relationship in Laravel instead of DB::table



                public function annonce($id) 
                $annonce = DB::table('annonce')
                ->join('article', 'annonce.ID_ANNONCE', '=', 'article.ID_ANNONCE')
                ->join('photo_articles', 'photo_articles.ID_ARTICLE', '=', 'article.ID_ARTICLE')
                ->select('annonce.*', 'article.NOM_ARTICLE','PHOTO_ARTICLE')
                ->where('annonce.ID_ANNONCE',$id)
                ->get();

                return view('single',['id' => $id])->with('annonce',$annonce);






                share|improve this answer

























                  0












                  0








                  0







                  You return statement should be like this return view('single',['id' => $id])->with('annonce',$annonce);



                  Note: Please use relationship in Laravel instead of DB::table



                  public function annonce($id) 
                  $annonce = DB::table('annonce')
                  ->join('article', 'annonce.ID_ANNONCE', '=', 'article.ID_ANNONCE')
                  ->join('photo_articles', 'photo_articles.ID_ARTICLE', '=', 'article.ID_ARTICLE')
                  ->select('annonce.*', 'article.NOM_ARTICLE','PHOTO_ARTICLE')
                  ->where('annonce.ID_ANNONCE',$id)
                  ->get();

                  return view('single',['id' => $id])->with('annonce',$annonce);






                  share|improve this answer













                  You return statement should be like this return view('single',['id' => $id])->with('annonce',$annonce);



                  Note: Please use relationship in Laravel instead of DB::table



                  public function annonce($id) 
                  $annonce = DB::table('annonce')
                  ->join('article', 'annonce.ID_ANNONCE', '=', 'article.ID_ANNONCE')
                  ->join('photo_articles', 'photo_articles.ID_ARTICLE', '=', 'article.ID_ARTICLE')
                  ->select('annonce.*', 'article.NOM_ARTICLE','PHOTO_ARTICLE')
                  ->where('annonce.ID_ANNONCE',$id)
                  ->get();

                  return view('single',['id' => $id])->with('annonce',$annonce);







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 25 at 4:29









                  Mayank DudakiyaMayank Dudakiya

                  886616




                  886616



























                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55330369%2fhref-returning-another-url%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                      Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                      Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript