mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-26 22:19:41 -08:00
07882110fa
We ajax this data in now
50 lines
1.2 KiB
PHP
Executable file
50 lines
1.2 KiB
PHP
Executable file
<?php
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Http\Controllers\AdminController;
|
|
use App\Models\Actionlog;
|
|
use View;
|
|
use Auth;
|
|
use Redirect;
|
|
use App\Models\Asset;
|
|
use App\Models\Company;
|
|
|
|
/**
|
|
* This controller handles all actions related to the Admin Dashboard
|
|
* for the Snipe-IT Asset Management application.
|
|
*
|
|
* @version v1.0
|
|
*/
|
|
class DashboardController extends Controller
|
|
{
|
|
/**
|
|
* Check authorization and display admin dashboard, otherwise display
|
|
* the user's checked-out assets.
|
|
*
|
|
* @author [A. Gianotto] [<snipe@snipe.net>]
|
|
* @since [v1.0]
|
|
* @return View
|
|
*/
|
|
public function getIndex()
|
|
{
|
|
// Show the page
|
|
if (Auth::user()->hasAccess('admin')) {
|
|
|
|
$asset_stats=null;
|
|
|
|
|
|
|
|
if ((!file_exists(storage_path().'/oauth-private.key')) || (!file_exists(storage_path().'/oauth-public.key'))) {
|
|
\Artisan::call('passport:install');
|
|
\Artisan::call('migrate', ['--force' => true]);
|
|
}
|
|
|
|
|
|
return View::make('dashboard')->with('asset_stats', $asset_stats);
|
|
} else {
|
|
// Redirect to the profile page
|
|
return redirect()->intended('account/view-assets');
|
|
}
|
|
}
|
|
}
|