Small tweaks to Dashboard controller

Still gettiing a bizarre `Non-static method App\Http\Controllers\DashboardController::index() should not be called statically` error

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2021-06-11 14:43:47 -07:00
parent 2cddd7faf0
commit 3095a78664
3 changed files with 23 additions and 17 deletions

View file

@ -2,15 +2,16 @@
namespace App\Http\Controllers;
use App\Http\Controllers\AdminController;
use Auth;
use View;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Artisan;
/**
* This controller handles all actions related to the Admin Dashboard
* for the Snipe-IT Asset Management application.
*
* @version v1.0
* @author A. Gianotto <snipe@snipe.net>
* @version v1.0
*/
class DashboardController extends Controller
{
@ -22,7 +23,7 @@ class DashboardController extends Controller
* @since [v1.0]
* @return View
*/
public function getIndex()
public function index()
{
// Show the page
if (Auth::user()->hasAccess('admin')) {
@ -35,7 +36,7 @@ class DashboardController extends Controller
$counts['grand_total'] = $counts['asset'] + $counts['accessory'] + $counts['license'] + $counts['consumable'];
if ((! file_exists(storage_path().'/oauth-private.key')) || (! file_exists(storage_path().'/oauth-public.key'))) {
\Artisan::call('migrate', ['--force' => true]);
Artisan::call('migrate', ['--force' => true]);
\Artisan::call('passport:install');
}

View file

@ -74,7 +74,6 @@
};
</script>
<!-- Add laravel routes into javascript Primarily useful for vue.-->
@routes
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<script src="{{ url(asset('js/html5shiv.js')) }}" nonce="{{ csrf_token() }}"></script>

View file

@ -418,16 +418,9 @@ Route::post(
'uses' => [Auth\LoginController::class, 'postTwoFactorAuth'], ]
);
Route::get(
'/',
[
'as' => 'home',
'middleware' => ['auth'],
'uses' => [DashboardController::class, 'getIndex'], ]
);
Route::group(['middleware' => 'web'], function () {
//Route::auth();
Route::get(
'login',
[
@ -452,6 +445,19 @@ Route::group(['middleware' => 'web'], function () {
);
});
Auth::routes();
//Auth::routes();
Route::get('/health', ['as' => 'health', 'uses' => [HealthController::class, 'get']]);
Route::get(
'/health',
[
'as' => 'health',
'uses' => [HealthController::class, 'get'],]
);
Route::get(
'/',
[
'as' => 'home',
'middleware' => ['auth'],
'uses' => [DashboardController::class, 'index'], ]
);