title: Laravel passed argument
body: <p>I have some problems with my Laravel app. I'm trying to make scraper and It looks like this.</p>
  <pre><code>&lt;?php
  
  namespace App\Http\Controllers;
  
  use App\Scraper\Amazon;
  use Illuminate\Http\Request;
  
  class ScraperController extends Controller
  {
      public $test;
  
      /**
       * Display a listing of the resource.
       *
       * @return \Illuminate\Http\Response
       */
      public function index()
      {
          $this-&gt;test = new Amazon();
         
          return $this-&gt;test;
      }
  </code></pre>
  <p>As you can see I have created new folder inside app that is called Scraper, and I have Amazon.php file that looks like:</p>
  <pre><code>&lt;?php
  
  namespace App\Scraper;
  
  use Goutte\Client;
  
  class Amazon
  {
      public string $test = ''; 
  
      public function __construct()
      {
          return &quot;test&quot;;
      }
  
      public function index()
      {
          $client = new Client();
          
          $crawler = $client-&gt;request('GET', 'https://www.amazon.co.uk/dp/B002SZEOLG/');
  
          $crawler-&gt;filter('#productTitle')-&gt;each(function ($node) {
              $this-&gt;test = $node-&gt;text().&quot;\n&quot;;
          });
  
          return $this-&gt;test;
      }
  }
  </code></pre>
  <p>And this is always returning error like</p>
  <blockquote>
  <p>TypeError: Argument 1 passed to
  Symfony\Component\HttpFoundation\Response::setContent() must be of the
  type string or null, object given,</p>
  </blockquote>
  <p>What am I doing wrong?</p>