title: Argument 2 passed to App\Http\Controllers\HomeController::productDetail() must be an instance of App\Product, string given
body: <p>I have route</p>
  
  <pre><code>Route::get('catalog/{category}/{product}', 'HomeController@productDetail')-&gt;name('product.index2');
  </code></pre>
  
  <p>and controller</p>
  
  <pre><code>public function productDetail(categories $categories, product $product)
  {
      $products = product::where('active', 1)-&gt;get();
      if($product-&gt;categories != $categories){
          abort(404);
      }
      return view('products', compact('product', 'products'));
  }
  </code></pre>
  
  <p>my error</p>
  
  <blockquote>
    <p>Argument 2 passed to
    App\Http\Controllers\HomeController::productDetail() must be an
    instance of App\Product, string given</p>
  </blockquote>
  
  <p>and front</p>
  
  <pre><code>&lt;ul class="accordion-menu"&gt;
      @foreach ($categories as $item)
          &lt;li&gt;
              &lt;div class="dropdownlink"&gt;{{$item-&gt;name}} &lt;img src="{{ asset('build/img/d1.svg') }}" alt="Банковские терминалы"&gt;&lt;/div&gt;
              &lt;ul class="submenuItems"&gt;
                  @foreach($item-&gt;children as $subcategory)
                      &lt;li&gt;&lt;a href="{{route('category.index2', $subcategory)}}"&gt;{{ $subcategory-&gt;name }}&lt;/a&gt;&lt;/li&gt;
                  @endforeach
  
              &lt;/ul&gt;
          &lt;/li&gt;
      @endforeach                    
  &lt;/ul&gt;
  </code></pre>
  
  <p>kernel.php</p>
  
  <pre><code>&lt;?php
  </code></pre>
  
  <p>namespace App\Http;</p>
  
  <p>use Illuminate\Foundation\Http\Kernel as HttpKernel;</p>
  
  <p>class Kernel extends HttpKernel
  {
      /**
       * The application's global HTTP middleware stack.
       *
       * These middleware are run during every request to your application.
       *
       * @var array
       */
      protected $middleware = [
          \App\Http\Middleware\CheckForMaintenanceMode::class,
          \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
          \App\Http\Middleware\TrimStrings::class,
          \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
          \App\Http\Middleware\TrustProxies::class,
      ];</p>
  
  <pre><code>/**
   * The application's route middleware groups.
   *
   * @var array
   */
  protected $middlewareGroups = [
      'web' =&gt; [
          \App\Http\Middleware\EncryptCookies::class,
          \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
          \Illuminate\Session\Middleware\StartSession::class,
          // \Illuminate\Session\Middleware\AuthenticateSession::class,
          \Illuminate\View\Middleware\ShareErrorsFromSession::class,
          \App\Http\Middleware\VerifyCsrfToken::class,
          \Illuminate\Routing\Middleware\SubstituteBindings::class,
      ],
  
      'api' =&gt; [
          'throttle:60,1',
          'bindings',
      ],
  ];
  
  /**
   * The application's route middleware.
   *
   * These middleware may be assigned to groups or used individually.
   *
   * @var array
   */
  protected $routeMiddleware = [
      'auth' =&gt; \App\Http\Middleware\Authenticate::class,
      'auth.basic' =&gt; \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
      'bindings' =&gt; \Illuminate\Routing\Middleware\SubstituteBindings::class,
      'cache.headers' =&gt; \Illuminate\Http\Middleware\SetCacheHeaders::class,
      'can' =&gt; \Illuminate\Auth\Middleware\Authorize::class,
      'guest' =&gt; \App\Http\Middleware\RedirectIfAuthenticated::class,
      'signed' =&gt; \Illuminate\Routing\Middleware\ValidateSignature::class,
      'throttle' =&gt; \Illuminate\Routing\Middleware\ThrottleRequests::class,
      'verified' =&gt; \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
  ];
  
  /**
   * The priority-sorted list of middleware.
   *
   * This forces non-global middleware to always be in the given order.
   *
   * @var array
   */
  protected $middlewarePriority = [
      \Illuminate\Session\Middleware\StartSession::class,
      \Illuminate\View\Middleware\ShareErrorsFromSession::class,
      \App\Http\Middleware\Authenticate::class,
      \Illuminate\Session\Middleware\AuthenticateSession::class,
      \Illuminate\Routing\Middleware\SubstituteBindings::class,
      \Illuminate\Auth\Middleware\Authorize::class,
  ];
  </code></pre>
  
  <p>}</p>