refactoring part 1

This commit is contained in:
Peter Papp
2021-03-14 12:23:14 +01:00
parent c5e9d29362
commit d0bd866354
26 changed files with 168 additions and 312 deletions
@@ -0,0 +1,61 @@
<?php
namespace App\Http\Controllers\Setup;
use App\Http\Controllers\Controller;
use Artisan;
use Illuminate\Http\Request;
use Schema;
class Maintenance extends Controller
{
/**
* Start maintenance mode
*/
public function up() {
$command = Artisan::call('up');
if ($command === 0) {
echo 'System is in production mode';
}
}
/**
* End maintenance mode
*/
public function down() {
$command = Artisan::call('down');
if ($command === 0) {
echo 'System is in maintenance mode';
}
}
/**
* Upgrade database
*/
public function upgrade()
{
$this->upgrade_database();
}
/**
* @return int|mixed
*/
private function upgrade_database()
{
$command = Artisan::call('migrate', [
'--force' => true
]);
if ($command === 0) {
echo 'Operation was successful.';
}
if ($command === 1) {
echo 'Operation failed.';
}
return $command;
}
}