title: Laravel Model Show Function returning null
body: <p>I have an installation of Laravel 5.6 and have setup multiple authentication.</p>
  
  <p>All is working except when I go into a resource show function the eloquent is not getting the record. Just returning null.</p>
  
  <p>I have search on Google for 2 days and just can't figure it out.</p>
  
  <p>Code as follows.</p>
  
  <p>web.php</p>
  
  <pre><code>Route::get('/', function () {
  return view('welcome');
  });
  
  Auth::routes();
  
  Route::get('/home', 'HomeController@index')-&gt;name('home');
  Route::get('/user/logout','Auth\LoginController@userLogout')-&gt;name('user.logout');
  
  //admin route for our multi-auth system
  
  Route::prefix('admin')-&gt;name('admin.')-&gt;group(function () {
      Route::get('/', 'AdminController@index')-&gt;name('dashboard');
      Route::get('/login', 'Auth\AdminLoginController@showLoginForm')-&gt;name('login');
      Route::post('/login', 'Auth\AdminLoginController@login')-&gt;name('login.submit');
      Route::get('/logout','Auth\AdminLoginController@logout')-&gt;name('logout');
  
      //admin password reset routes
      Route::post('/password/email','Auth\AdminForgotPasswordController@sendResetLinkEmail')-&gt;name('password.email');
      Route::get('/password/reset','Auth\AdminForgotPasswordController@showLinkRequestForm')-&gt;name('password.request');
      Route::post('/password/reset','Auth\AdminResetPasswordController@reset');
      Route::get('/password/reset/{token}','Auth\AdminResetPasswordController@showResetForm')-&gt;name('password.reset');
  
  });
  
  Route::resource('/admin/stock_categories','Admin\Stock\CategoryController');
  </code></pre>
  
  <p>The resource I am working with is the stock_categories above.</p>
  
  <p>My routes:list is as follows.</p>
  
  <pre><code>|        | POST      | admin/stock_categories                       | stock_categories.store   | App\Http\Controllers\Admin\Stock\CategoryController@store                   | web,auth:admin                               |
  |        | GET|HEAD  | admin/stock_categories                       | stock_categories.index   | App\Http\Controllers\Admin\Stock\CategoryController@index                   | web,auth:admin                               |
  |        | GET|HEAD  | admin/stock_categories/create                | stock_categories.create  | App\Http\Controllers\Admin\Stock\CategoryController@create                  | web,auth:admin                               |
  |        | GET|HEAD  | admin/stock_categories/{stock_category}      | stock_categories.show    | App\Http\Controllers\Admin\Stock\CategoryController@show                    | web,auth:admin                               |
  |        | PUT|PATCH | admin/stock_categories/{stock_category}      | stock_categories.update  | App\Http\Controllers\Admin\Stock\CategoryController@update                  | web,auth:admin                               |
  |        | DELETE    | admin/stock_categories/{stock_category}      | stock_categories.destroy | App\Http\Controllers\Admin\Stock\CategoryController@destroy                 | web,auth:admin                               |
  |        | GET|HEAD  | admin/stock_categories/{stock_category}/edit | stock_categories.edit    | App\Http\Controllers\Admin\Stock\CategoryController@edit                    | web,auth:admin         
  </code></pre>
  
  <p>When I show the list it appears correctly.</p>
  
  <p>But when I click into an item and open the URL</p>
  
  <pre><code>/admin/stock_categories/1
  </code></pre>
  
  <p>It returns an empty result. I.e doesn't show the item.</p>
  
  <p>My model code is as follows.</p>
  
  <pre><code>&lt;?php
  
  namespace App;
  
  use Illuminate\Database\Eloquent\Model;
  use Illuminate\Notifications\Notifiable;
  
  
  class Category extends Model
  {
      use Notifiable;
  
      protected $table = 'stock_categories';
      //protected $fillable = ['name, discount'];
  
      //
      function items() {
        return $this-&gt;hasMany('App\Item','category_id');
      }
  
  }
  </code></pre>
  
  <p>My controller is code is as follows.</p>
  
  <pre><code>/**
   * Create a new controller instance.
   *
   * @return void
   */
  public function __construct()
  {
      $this-&gt;middleware('auth:admin');
  }
  
  
  /**
   * Display a listing of the resource.
   *
   * @return \Illuminate\Http\Response
   */
  public function index()
  {
      $category = Category::where('master_category_id',0)-&gt;orderBy('name')-&gt;paginate(20);
      $master_category_id = 0;
      return view('admin.stock.top_list',compact('category','master_category_id'));
  }
  
  /**
   * Show the form for creating a new resource.
   *
   * @return \Illuminate\Http\Response
   */
  public function create()
  {
      //
  }
  
  /**
   * Store a newly created resource in storage.
   *
   * @param  \Illuminate\Http\Request  $request
   * @return \Illuminate\Http\Response
   */
  public function store(Request $request)
  {
      //
  }
  
  /**
   * Display the specified resource.
   *
   * @param  \App\Category  $category
   * @return \Illuminate\Http\Response
   */
  
  
  public function show(Category $category)
  {
      return view('admin.stock.category',compact('category'));
  }
  </code></pre>
  
  <p>When I var_dump($category) inside the show function I get this.</p>
  
  <pre><code>object(App\Category)#755 (26) {
    ["table":protected]=&gt;
    string(16) "stock_categories"
    ["connection":protected]=&gt;
    NULL
    ["primaryKey":protected]=&gt;
    string(2) "id"
    ["keyType":protected]=&gt;
    string(3) "int"
    ["incrementing"]=&gt;
    bool(true)
    ["with":protected]=&gt;
    array(0) {
    }
    ["withCount":protected]=&gt;
    array(0) {
    }
    ["perPage":protected]=&gt;
    int(15)
    ["exists"]=&gt;
    bool(false)
    ["wasRecentlyCreated"]=&gt;
    bool(false)
    ["attributes":protected]=&gt;
    array(0) {
    }
    ["original":protected]=&gt;
    array(0) {
    }
    ["changes":protected]=&gt;
    array(0) {
    }
    ["casts":protected]=&gt;
    array(0) {
    }
    ["dates":protected]=&gt;
    array(0) {
    }
    ["dateFormat":protected]=&gt;
    NULL
    ["appends":protected]=&gt;
    array(0) {
    }
    ["dispatchesEvents":protected]=&gt;
    array(0) {
    }
    ["observables":protected]=&gt;
    array(0) {
    }
    ["relations":protected]=&gt;
    array(0) {
    }
    ["touches":protected]=&gt;
    array(0) {
    }
    ["timestamps"]=&gt;
    bool(true)
    ["hidden":protected]=&gt;
    array(0) {
    }
    ["visible":protected]=&gt;
    array(0) {
    }
    ["fillable":protected]=&gt;
    array(0) {
    }
    ["guarded":protected]=&gt;
    array(1) {
      [0]=&gt;
      string(1) "*"
    }
  }
  </code></pre>
  
  <p>My middleware looks like this.</p>
  
  <pre><code>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 = [
          \Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
          \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
          \App\Http\Middleware\TrimStrings::class,
          \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
  
      ];
  
      /**
       * 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; \Illuminate\Auth\Middleware\Authenticate::class,
          'auth.basic' =&gt; \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
          'bindings' =&gt; \Illuminate\Routing\Middleware\SubstituteBindings::class,
          'can' =&gt; \Illuminate\Auth\Middleware\Authorize::class,
          'guest' =&gt; \App\Http\Middleware\RedirectIfAuthenticated::class,
          'throttle' =&gt; \Illuminate\Routing\Middleware\ThrottleRequests::class,
      ];
  }
  </code></pre>
  
  <p>I am hoping that there is just something stupid that I have done and for the life of me I cannot find.</p>
  
  <p>So to summarise, I click on an item, load the show resource route but the item is not retrieved from the database.</p>
  
  <p>Any help with be greatly apreciated.</p>
  
  <p>Thanks</p>