FEATURE: add filter to action log
This commit is contained in:
@@ -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]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user