title: How can I use middleware to authorize my laravel Restfull API
body: <p>I am using laravel/passport and I want to authorize my API endpoint Then
  The result I'm receiving declares that a <strong>route(user/login)</strong> is not defined with status code 500 in postman</p>
  <h3>Route</h3>
  <p><strong>Route::get('all/users', 'UserController@index')-&gt;middleware('auth');</strong></p>
  <h3>Controller</h3>
  <pre><code>    {  
          return new UserResource(User::findOrFail($id));
      } 
  </code></pre>
  <h3>User Model</h3>
  <pre><code>use Laravel\Passport\HasApiTokens;
  use Illuminate\Contracts\Auth\MustVerifyEmail;
  use Illuminate\Foundation\Auth\User as Authenticatable;
  use Illuminate\Notifications\Notifiable;
  
  
  class User extends Authenticatable
  {
      use Notifiable, HasApiTokens;
      
      protected $fillable = [
          'name', 'email', 'password','balance','phone'
      ];
  
      
      protected $hidden = [
          'password', 'remember_token',
      ]; 
  }```
  </code></pre>