title: Laravel soft delete at User model not working
body: <p>I'm using Laravel 5.4.</p>
  
  <p>I add soft delete to User model.</p>
  
  <p>Like <code>use SoftDeletes</code> and <code>$dates = ['deleted_at']</code></p>
  
  <p>When I use <code>User::destroy(1)</code> it will actually add deleted_at value in database, so I'm sure there is no setup problem about SoftDeletes.</p>
  
  <p>But when I get user list and use User model to login, it won't filter deleted row.</p>
  
  <p>Is there any one have the same problem? Please tell me how you solve this.</p>
  
  <p>--Update--</p>
  
  <p>App\User.php</p>
  
  <pre><code>&lt;?php
  
  namespace App;
  
  use Illuminate\Database\Eloquent\SoftDeletes;
  use Illuminate\Foundation\Auth\User as Authenticatable;
  use Illuminate\Notifications\Notifiable;
  use Laravel\Passport\HasApiTokens;
  use Laravel\Scout\Searchable;
  
  class User extends Authenticatable
  {
      /**
       * Added for passport - api login checking
       */
      use HasApiTokens, Notifiable, Searchable;
  
      use SoftDeletes;
  
      /**
       * The attributes that are mass assignable.
       *
       * @var array
       */
      protected $fillable = [
          'name',
          'email',
          'password',
      ];
  
      /**
       * The attributes that should be hidden for arrays.
       *
       * @var array
       */
      protected $hidden = [
          'password',
      ];
  
      protected $dates = [
          'created_at',
          'updated_at',
          'deleted_at',
      ];
  }
  </code></pre>
  
  <p>UserController.php</p>
  
  <pre><code>&lt;?php
  
  namespace App\Http\Controllers;
  
  use App\Events\ErrorLog;
  use App\Helpers;
  use App\Http\Controllers\Controller;
  use App\User;
  use Validator;
  use Illuminate\Http\Request;
  
  class UserController extends Controller
  {
      /**
       * Display a listing of the resource.
       *
       * @return \Illuminate\Http\Response
       */
      public function index(Request $request)
      {
          $fields = $request-&gt;fields ? $request-&gt;fields :
              [
                  'id',
                  'name',
                  'email',
              ];
  
          $search = function ($query) {
              $query-&gt;where('name', 'like', '%' . request()-&gt;nameOrEmail . '%')
                  -&gt;orWhere('email', 'like', '%' . request()-&gt;nameOrEmail . '%');
          };
  
          $users = User::where($search)
              -&gt;orderBy('id')
              -&gt;paginate(20, $fields);
  
          return response()-&gt;json([
              'status' =&gt; 'success',
              'data' =&gt; $users,
          ]);
      }
  }
  </code></pre>