- API routes refactoring part 3

This commit is contained in:
Peter Papp
2021-02-26 17:10:21 +01:00
parent 00e515e995
commit fd02fbfe08
4 changed files with 17 additions and 25 deletions

View File

@@ -0,0 +1,63 @@
<?php
namespace App\Http\Controllers\General;
use App\Http\Controllers\Controller;
use App\Page;
use App\Setting;
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;
}
}