title: SQLSTATE[HY000] [1049] Unknown database 'laravel'
body: <p>I am getting this error while trying to save an object into DB.</p>
  
  <blockquote>
    <p>SQLSTATE[HY000] [1049] Unknown database 'laravel' (SQL: insert into <code>cards</code> (<code>card_price</code>, <code>active</code>, <code>updated_at</code>, <code>created_at</code>) values (0, 1, 2019-10-10 15:14:43, 2019-10-10 15:14:43))</p>
  </blockquote>
  
  <p><strong>.env</strong></p>
  
  <pre><code>DB_CONNECTION=mysql
  DB_HOST=127.0.0.1
  DB_PORT=3306
  DB_DATABASE=cardgame
  DB_USERNAME=root
  DB_PASSWORD=P@assword1!
  </code></pre>
  
  <p><strong>Database.php</strong></p>
  
  <pre><code>'mysql' =&gt; [
          'driver' =&gt; 'mysql',
          'url' =&gt; env('DATABASE_URL'),
          'host' =&gt; env('DB_HOST', '127.0.0.1'),
          'port' =&gt; env('DB_PORT', '3306'),
          'database' =&gt; env('DB_DATABASE', 'forge'),
          'username' =&gt; env('DB_USERNAME', 'forge'),
          'password' =&gt; env('DB_T_PASSWORD', ''),
          'unix_socket' =&gt; env('DB_SOCKET', ''),
          'charset' =&gt; 'utf8mb4',
          'collation' =&gt; 'utf8mb4_unicode_ci',
          'prefix' =&gt; '',
          'prefix_indexes' =&gt; true,
          'strict' =&gt; true,
          'engine' =&gt; null,
          'options' =&gt; extension_loaded('pdo_mysql') ? array_filter([
              PDO::MYSQL_ATTR_SSL_CA =&gt; env('MYSQL_ATTR_SSL_CA'),
          ]) : [],
      ],
  </code></pre>
  
  <p><strong>CardController.php</strong></p>
  
  <pre><code>  public function generateCards()
    {
    $card = new Card();
    $card-&gt;card_price = 0;
    $card-&gt;active = 1;
    $card-&gt;save();
    }
  </code></pre>
  
  <p><strong>Web.php</strong></p>
  
  <pre><code> Route::get('/generate-cards', 'CardController@generateCards');
  </code></pre>
  
  <p><strong>Card.php</strong></p>
  
  <pre><code>class Card extends Model
  {
   protected  $guarded =[];
  }
  </code></pre>
  
  <p><strong>Migration file</strong></p>
  
  <pre><code>public function up()
  {
      Schema::create('cards', function (Blueprint $table) {
          $table-&gt;bigIncrements('id');
          $table-&gt;integer('card_price');
          $table-&gt;integer('active');
          $table-&gt;timestamps();
      });
  }
  </code></pre>
  
  <p>I've tried <strong>clearing cache</strong> and also have edited <code>DB_PASSWORD</code> To <code>DB_T_PASSWORD</code> as this corrected a similar issue earlier. Double checked the <strong>DB name</strong>, <strong>passwords</strong> etc &amp; also other projects are already running also. I'm not able to figure it out.</p>