mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-19 16:32:15 +00:00
- added function to upgrade language translations
- maintenance gate
This commit is contained in:
@@ -3,17 +3,34 @@
|
||||
namespace App\Http\Controllers\App;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Language;
|
||||
use App\Models\LanguageTranslation;
|
||||
use App\Services\LanguageService;
|
||||
use Artisan;
|
||||
use DB;
|
||||
use Gate;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Contracts\Routing\ResponseFactory;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Schema;
|
||||
|
||||
class Maintenance extends Controller
|
||||
{
|
||||
/**
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
// Check admin permission
|
||||
Gate::authorize('maintenance');
|
||||
}
|
||||
|
||||
/**
|
||||
* Start maintenance mode
|
||||
*/
|
||||
public function up() {
|
||||
public function up()
|
||||
{
|
||||
$command = Artisan::call('up');
|
||||
|
||||
if ($command === 0) {
|
||||
@@ -24,7 +41,8 @@ class Maintenance extends Controller
|
||||
/**
|
||||
* End maintenance mode
|
||||
*/
|
||||
public function down() {
|
||||
public function down()
|
||||
{
|
||||
$command = Artisan::call('down');
|
||||
|
||||
if ($command === 0) {
|
||||
@@ -33,17 +51,23 @@ class Maintenance extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Upgrade database
|
||||
* Get new language translations from default translations
|
||||
* and insert it into database
|
||||
*
|
||||
* @return Application|ResponseFactory|Response
|
||||
*/
|
||||
public function upgrade()
|
||||
public function upgrade_translations()
|
||||
{
|
||||
$this->upgrade_database();
|
||||
resolve(LanguageService::class)
|
||||
->upgrade_language_translations();
|
||||
|
||||
return response('Done.', 201);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|mixed
|
||||
*/
|
||||
private function upgrade_database()
|
||||
public function upgrade_database()
|
||||
{
|
||||
$command = Artisan::call('migrate', [
|
||||
'--force' => true
|
||||
|
||||
Reference in New Issue
Block a user