master_template/app/Http/Controllers/Installer/UpdateController.php
2024-06-11 12:16:24 +05:45

63 lines
1.5 KiB
PHP
Executable File

<?php
namespace App\Http\Controllers\Installer;
use Illuminate\Routing\Controller;
use App\Helpers\Installer\DatabaseManager;
use App\Helpers\Installer\InstalledFileManager;
class UpdateController extends Controller
{
use \App\Helpers\Installer\MigrationsHelper;
/**
* Display the updater welcome page.
*
* @return \Illuminate\View\View
*/
public function welcome()
{
return view('vendor.installer.update.welcome');
}
/**
* Display the updater overview page.
*
* @return \Illuminate\View\View
*/
public function overview()
{
$migrations = $this->getMigrations();
$dbMigrations = $this->getExecutedMigrations();
return view('vendor.installer.update.overview', ['numberOfUpdatesPending' => count($migrations) - count($dbMigrations)]);
}
/**
* Migrate and seed the database.
*
* @return \Illuminate\View\View
*/
public function database()
{
$databaseManager = new DatabaseManager;
$response = $databaseManager->migrateAndSeed();
return redirect()->route('LaravelUpdater::final')
->with(['message' => $response]);
}
/**
* Update installed file and display finished view.
*
* @param InstalledFileManager $fileManager
* @return \Illuminate\View\View
*/
public function finish(InstalledFileManager $fileManager)
{
$fileManager->update();
return view('vendor.installer.update.finished');
}
}