FEATURE: add filter to action log

This commit is contained in:
Michal Kváček
2016-09-27 23:24:03 +02:00
parent 9039334138
commit 60c3582947
8 changed files with 71 additions and 32 deletions
@@ -4,6 +4,8 @@ namespace App\Http\Controllers\Admin\ActionLog;
use App\Http\Controllers\Admin\Controller;
use App\Models\ActionLog;
use App\Models\User;
use Illuminate\Support\Facades\Input;
class Overview extends Controller
{
@@ -23,13 +25,27 @@ class Overview extends Controller
$this->log = $log;
}
/**
* Get overview of logged actions
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function getOverview()
{
$actions = $this->log->getLogActionsQuery(true)
->paginate(25);
$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]);
return view('admin.actionLog.overview', ['actions' => $actions, 'user' => $user]);
}
}