mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-18 00:02:15 +00:00
api refactoring
This commit is contained in:
@@ -1,51 +1,21 @@
|
||||
<?php
|
||||
namespace Domain\Homepage\Controllers;
|
||||
|
||||
use DB;
|
||||
use PDOException;
|
||||
use Domain\Pages\Models\Page;
|
||||
use Domain\Settings\Actions\GetConfigAction;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Support\Status\Actions\GetServerSetupStatusAction;
|
||||
|
||||
class IndexController
|
||||
{
|
||||
public function __construct(
|
||||
public GetServerSetupStatusAction $getServerSetupStatus,
|
||||
) {
|
||||
}
|
||||
public GetConfigAction $getConfig,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Show index page
|
||||
*/
|
||||
public function __invoke(): Application|Factory|View
|
||||
public function __invoke(): View
|
||||
{
|
||||
$setup_status = 'installation-needed';
|
||||
|
||||
try {
|
||||
// Try to connect to database
|
||||
DB::getPdo();
|
||||
|
||||
// Get setup status
|
||||
$setup_status = get_setup_status();
|
||||
|
||||
// Get app pages
|
||||
$pages = Page::all();
|
||||
|
||||
// Get all settings
|
||||
$settings = get_settings_in_json();
|
||||
} catch (PDOException $e) {
|
||||
}
|
||||
|
||||
if ($setup_status === 'installation-needed') {
|
||||
$status_check = ($this->getServerSetupStatus)();
|
||||
}
|
||||
|
||||
return view('index')
|
||||
->with('status_check', $status_check ?? [])
|
||||
->with('settings', $settings ?? null)
|
||||
->with('legal', $pages ?? null)
|
||||
->with('installation', $setup_status);
|
||||
->with('config', json_decode(json_encode(($this->getConfig)())));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user