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

                      How to preserve electronics (computers, tablets and phones) for hundreds of years Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) The network's official Twitter account is up and running again. What content…How might modern humans leave a message for 50,000 years?How would an aquatic race develop computers?How do we make computers care for human life?Keeping supplies for 1000 yearsWhat will cell phones become in 100 years?What body armor protects against a laser?Could a society attain 1800s technology if limited to using copper and bronze?Electricity power (magic) and electronicsScavenging metal resources in post-apocalypse after 100 yearsWhy would precursors create devices that can survive and still work after hundreds of years?

                      155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해

                      Convert JSON to MapSimplest way to convert a string representing JSON array into Java array List of key value pairsHow to take String JSON values into HashMapConvert a JSON String to a HashMapCreating BSON object from JSON stringJSONObject - How to get a value ?Better Map ConstructorReading JSON from Url javaUpdate columns if input values are not null otherwise ignore and keep the existing values of column in databaseHow to store object represented as Json string into Couchbase Lite?Go JSON into MapHow do I efficiently iterate over each entry in a Java Map?Sort a Map<Key, Value> by valuesHow to round a number to n decimal places in JavaCan comments be used in JSON?How do I read / convert an InputStream into a String in Java?How can I pretty-print JSON in a shell script?What is the correct JSON content type?How can I deserialize JSON to a simple Dictionary<string,string> in ASP.NET?Why does Google prepend while(1); to their JSON responses?Parse JSON in JavaScript?