title: laravel - how to show resource data in view as an html
body: <p>hi i have a resource that returns the API JSON correctly now I want to show that data in HTML like the Laravel home page inside a MacBook SVG how can I access that JSON in my controller and send it to view because I already copied the MacBook and the code snippet of laravel.com so here is my code :
  resource :</p>
  
  <pre><code>public function toArray($request)
  {
      return parent::toArray($request);
  }
  </code></pre>
  
  <p>and controller which is working fine as api now :</p>
  
  <pre><code>    try {
          $data = Accommodation::paginate(15);
      } catch (\Exception $e) {
          Log::error($e-&gt;getMessage());
          throw new HttpException(500, $e-&gt;getMessage());
      }
      return new AccommodationResource($data);
  </code></pre>
  
  <p>now instead of that return of resource i want to return a view and send the $data as a json to it</p>