52 lines
1.1 KiB
PHP
52 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Admin\ActionLog;
|
|
|
|
use App\Http\Controllers\Admin\Controller;
|
|
use App\Models\ActionLog\ActionLog;
|
|
use App\Models\User;
|
|
use Illuminate\Support\Facades\Input;
|
|
|
|
class Overview extends Controller
|
|
{
|
|
/**
|
|
* @var ActionLog
|
|
*/
|
|
private $log;
|
|
|
|
/**
|
|
* ActionLog constructor.
|
|
*
|
|
* @param ActionLog $log
|
|
*/
|
|
public function __construct(ActionLog $log)
|
|
{
|
|
parent::__construct();
|
|
$this->log = $log;
|
|
}
|
|
|
|
/**
|
|
* Get overview of logged actions
|
|
*
|
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
|
*/
|
|
public function getOverview()
|
|
{
|
|
$user = null;
|
|
$userId = Input::get('userId');
|
|
|
|
$actions = $this->log->getLogActionsQuery(true);
|
|
|
|
if ($userId) {
|
|
$user = User::findOrFail($userId);
|
|
$actions->where('users.id', $userId);
|
|
}
|
|
|
|
$actions = $actions->paginate(25);
|
|
|
|
$this->log->translateLogMessages($actions);
|
|
|
|
return view('admin.actionLog.overview', ['actions' => $actions, 'user' => $user]);
|
|
}
|
|
}
|