title: Multi auth API token laravel 5.4
body: <p>I want to create Multi auth that have two parts (user and pemandu_bas). but when i tested POST 'pemandu_bas' token to postman,  my 'pemandu_bas' is doesn't works as api. It keep show error like this <a href="https://i.stack.imgur.com/NSNVb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NSNVb.png" alt="this"></a>.This is my  config/auth.php</p>
  
  <pre><code>'guards' =&gt; [
      'web' =&gt; [
          'driver' =&gt; 'session',
          'provider' =&gt; 'users',
      ],
  
      'api' =&gt; [
          'driver' =&gt; 'token',
          'provider' =&gt; 'users',
      ],
  
      'pemandu_bas' =&gt; [
          'driver' =&gt; 'token',
          'provider' =&gt; 'pemandu_bas',
      ],
  ],
  
  /*
  |--------------------------------------------------------------------------
  | User Providers
  |--------------------------------------------------------------------------
  |
  | All authentication drivers have a user provider. This defines how the
  | users are actually retrieved out of your database or other storage
  | mechanisms used by this application to persist your user's data.
  |
  | If you have multiple user tables or models you may configure multiple
  | sources which represent each model / table. These sources may then
  | be assigned to any extra authentication guards you have defined.
  |
  | Supported: "database", "eloquent"
  |
  */
  
  'providers' =&gt; [
      'users' =&gt; [
          'driver' =&gt; 'eloquent',
          'model' =&gt; App\Penjaga::class,
      ],
  
      'pemandu_bas' =&gt; [
          'driver' =&gt; 'eloquent',
          'model' =&gt;  App\Driver::class,
      ],
  ],
  </code></pre>
  
  <p>this is my 'pemandu_bas' controller</p>
  
  <pre><code>&lt;?php
  
  namespace App\Http\Controllers\api;
  
  use Validator;
  use \App\Driver;
  use Illuminate\Http\Request;
  use App\Http\Controllers\Controller;
  use Illuminate\Support\Facades\Auth;
  
  class ApiPemanduBasController extends Controller{
  
  public function loginPemandu(Request $request)
  {
  
      $this-&gt;validate($request, [
          'username' =&gt; 'required',
          'password' =&gt; 'required'
      ]);
  
  
      if (Auth::attempt(['username' =&gt; $request-&gt;username, 'password' =&gt; $request-&gt;password])) {
          // Authentication passed
         $pemandu_bas = Auth::guard('pemandu_bas')-&gt;user();
         $pemandu_bas-&gt;api_token = str_random(60);
         $pemandu_bas-&gt;save();
      }else
      {
  // Authentication failed
          return response()-&gt;json([
          'error' =&gt; true,
          'message' =&gt; 'Login failed wrong user credentials',
      ], 400);
      }
      // Return token
      return response()-&gt;json([
          'error' =&gt; false,
          'message' =&gt; 'login successful',
          'token' =&gt; $pemandu_bas-&gt;api_token,
      ], 200);
  
  }
  
  }
  </code></pre>
  
  <p>this is my api.php</p>
  
  <pre><code>Route::post('loginPemandu', 'Api\ApiPemanduBasController@loginPemandu');
  </code></pre>
  
  <p>and this is my Driver.php</p>
  
  <pre><code>&lt;?php
  
  namespace App;
  
  use Illuminate\Notifications\Notifiable;
  use Illuminate\Foundation\Auth\Driver as Authenticatable;
  
  class Driver extends Authenticatable
  {
  use Notifiable;
  
  protected $guard = 'pemandu_bas';
  
  protected $fillable 
   ['pemandu_nama','pemandu_tel','username','password',
   'pemandu_noPlat','sekolah_id'];
  
  
  /**
   * The attributes that should be hidden for arrays.
   *
   * @var array
   */
  protected $hidden = [
      'password',
      'remember_token',
      'api_token',
      'created_at',
      'updated_at'
  ];
  
  public function School(){
    return $this-&gt;hasMany('App\School');
  }
  
  
   }
  </code></pre>