title: Too few arguments to function App\Http\Controllers\Admin\AccountsController::index(), 0 passed and exactly 1 expected in laravel
body: <p>The session is being destroyed after successfully logged in or there's some error with the guard that couldn't retain the session. When asked for your_session_key the on the view of the dashboard, it provides null.</p>
  
  <pre><code>Route::group(['prefix' =&gt; 'admin'], function () {
  Route::namespace('Admin')-&gt;group(function () {
  Route::group(['middleware' =&gt; ['admin_middle','auth:admin']] , function () {
          Route::get('accounts/', 'AccountsController@index')-&gt;name('admin.accounts');
          });
      });
  });
  </code></pre>
  
  <p>Middleware: App\Http\Middleware\RedirectIfNotAdmin //Registered in Kernel as         'admin_middle' => \App\Http\Middleware\RedirectIfNotAdmin::class,</p>
  
  <pre><code>class RedirectIfNotAdmin
  {
  public function handle($request, Closure $next, $guard = 'admin')
  {
      if (!auth()-&gt;guard($guard)-&gt;check()) {
          $request-&gt;session()-&gt;flash('error', 'You must be an Admin to see this page');
          return redirect(route('auth.admin.login'));
      }
  
      return $next($request);
  }
  }
  </code></pre>
  
  <p>Guard: config/auth.php // Custom Guard</p>
  
  <pre><code>'guards' =&gt; [
  'admin' =&gt; [
      'driver' =&gt; 'session',
      'provider' =&gt; 'admin',
  
  ],
  ],
  </code></pre>
  
  <p>AccountsController: Controllers\AccountsController  </p>
  
  <p>class AccountsController extends Controller
  {</p>
  
  <pre><code>public function __construct(AdminRepositoryInterface $adminRepository) {
      $this-&gt;adminRepo = $adminRepository;
  }
  
  private $adminRepo;
  public function index(int $id)
  {
      $admin = $this-&gt;adminRepo-&gt;findAdminById($id);
  
      $talentRepo = new AdminRepository($admin);
  
  
      return view('admin.accounts');
  }
  </code></pre>
  
  <p>} </p>
  
  <p>AdminRepositoryInterface: App\Shop\Admins\Repositories\Interfaces\AdminRepositoryInterface;</p>
  
  <pre><code>interface AdminRepositoryInterface extends BaseRepositoryInterface
  {
  public function findAdminById(int $id) : Admin;
  }
  </code></pre>
  
  <p>AdminRepository: App\Shop\Admins\Repositories\AdminRepository</p>
  
  <pre><code>class AdminRepository extends BaseRepository implements AdminRepositoryInterface
  {
  public function findAdminById(int $id) : Admin
  {
      try {
          return $this-&gt;findOneOrFail($id);
      } catch (ModelNotFoundException $e) {
          throw new AdminNotFoundException($e);
      }
  }
  }
  </code></pre>
  
  <p>View: admin\accounts.blade</p>
  
  <pre><code>@if (Session::has('YOUR_SESSION_KEY'))
  {{-- do something with session key --}} 
  @else
  {{-- session key does not exist  --}} //this has been printed is the ID variable is not passed
  @endif
  {{$admin-&gt;name}}
   &lt;br /&gt;{{$admin-&gt;email}}
  </code></pre>