Sebpro\ArtisanExt\ArtisanExt::checkDb PHP Méthode

checkDb() public static méthode

Checks the database connection.
public static checkDb ( ) : boolean
Résultat boolean
    public static function checkDb()
    {
        if (DB::connection('mysql')->table(DB::raw('DUAL'))->first([DB::raw(1)])) {
            return true;
        }
        return false;
    }

Usage Example

 /**
  * Execute the console command.
  *
  * @return void
  */
 public function handle()
 {
     if (ArtisanExt::checkDb()) {
         return $this->info('Succesfully connected to the database.');
     }
     return $this->error('Failed to connect to the database.');
 }
All Usage Examples Of Sebpro\ArtisanExt\ArtisanExt::checkDb