title: Route not getting correct format of url in api
body: <p>Im new to Laravel Rest APIs. While trying tutorials I got this error of showing the link to the next route.</p>
  
  <pre><code>{  
      "data":{  
          "name":"mollitia",
          "totalPrice":307.44,
          "rating":5,
          "href":{  
              "reviews":"http:\/\/127.0.0.1:8000\/api\/product\/5\/reviews"
          }
      }
  }
  </code></pre>
  
  <p>I need to get the href for reviews as,</p>
  
  <pre><code>"reviews":"http://127.0.0.1:8000/api/products/5/reviews"
  </code></pre>
  
  <p><strong>resource</strong>:</p>
  
  <pre><code>&lt;?php
  namespace App\Http\Resources\Product;
  use Illuminate\Http\Resources\Json\Resource;
  class ProductResource extends Resource
  {
      /**
       * Transform the resource into an array.
       *
       * @param  \Illuminate\Http\Request
       * @return array
       */
      public function toArray($request)
      {
          return [
              'name' =&gt; $this-&gt;name,
              'totalPrice' =&gt; round(( 1 - ($this-&gt;discount/100)) * $this-&gt;price,2),
              'rating' =&gt; $this-&gt;reviews-&gt;count() &gt; 0 ? round($this-&gt;reviews-&gt;sum('star')/$this-&gt;reviews-&gt;count(),2) : 'No rating yet',
              'href' =&gt; [
                  'reviews' =&gt; route('reviews.index',$this-&gt;id)
              ]
          ];
      }
  }
  </code></pre>
  
  <p>What have I done wrong? </p>