Skip to content
Snippets Groups Projects

Resolve "Fix Admin Interface"

Merged Dominik Hebeler requested to merge 928-fix-admin-interface into development
9 files
+ 157
34
Compare changes
  • Side-by-side
  • Inline
Files
9
+ 55
0
 
<?php
 
 
namespace App\Console\Commands;
 
 
use DB;
 
use Illuminate\Console\Command;
 
 
class WaitDB extends Command
 
{
 
/**
 
* The name and signature of the console command.
 
*
 
* @var string
 
*/
 
protected $signature = 'wait:db';
 
 
/**
 
* The console command description.
 
*
 
* @var string
 
*/
 
protected $description = 'Waits until default DB connection is available. ';
 
 
/**
 
* Create a new command instance.
 
*
 
* @return void
 
*/
 
public function __construct()
 
{
 
parent::__construct();
 
}
 
 
/**
 
* Execute the console command.
 
*
 
* @return mixed
 
*/
 
public function handle()
 
{
 
$starttime = microtime(true);
 
 
while (microtime(true) - $starttime < 60) {
 
try {
 
$connection = DB::connection('mysql')->getPdo();
 
$this->line("Connection to database successfull");
 
return 0;
 
} catch (\Exception $e) {
 
$this->error($e->getMessage());
 
sleep(1);
 
}
 
}
 
return 1;
 
}
 
}
Loading