title: Calling model inside a middleware laravel
body: <p>I am trying to call a model <code>Readdb</code> inside a middleware. but I am getting error : </p>
  
  <blockquote>
    <p>Class 'app\Models\Readdb' not found</p>
  </blockquote>
  
  <p>My middlware code is:</p>
  
  <pre><code>&lt;?php
  
  namespace App\Http\Middleware;
  
  use Closure;
  use App\Models\Readdb;
  
  class Adminlogin {
  
      public function handle($request, Closure $next) {
          if (!$request-&gt;session()-&gt;has('userid')) {
              $db = new Readdb();
              return response()-&gt;view('admin.auth.login');
          } else {
              return response()-&gt;view('admin.dash');
          }
          return $next($request);
      }
  
  }
  </code></pre>
  
  <p><strong>Readdb File:</strong></p>
  
  <pre><code>&lt;?php
  namespace App;
  
  use \Illuminate\Database\Eloquent\Model;
  use Illuminate\Support\Facades\DB;
  
  class Readdb extends Model {
  
      public function get_setting($name) {
          $data = DB::table('setting')-&gt;select('value')-&gt;where('name', '=', $name)-&gt;get();
          return $data-&gt;value;
      }
  
  }
  </code></pre>
  
  <p>path to readdb is: <code>/var/www/html/ecommerce/app/Models/Readdb.php</code></p>