FEATURE: use even more route model binding

This commit is contained in:
Michal Kváček
2017-08-01 19:51:12 +02:00
parent 3275e5aeed
commit 2d60010f9e
16 changed files with 158 additions and 100 deletions
@@ -22,18 +22,14 @@ class UserDetail extends Controller
$this->log = $log;
}
public function getDetail($id = null)
public function getDetail(User $user = null)
{
// when no user specified, lets assume we want to edit "me"
if (!$id) {
$id = Auth::user()->id;
if (!$user->exists()) {
$id = Auth::user();
}
// try to find given user
$user = User::findOrFail($id);
$actions = $this->log->getUserActions($id, 10);
$actions = $this->log->getUserActions($user->id, 10);
$roles = UserRoles::getWithTranslations();
$states = UserStates::getWithTranslations();