Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Poyigi <[email protected]>
  • Loading branch information
sampoyigi committed Jan 14, 2024
1 parent 3c114b8 commit 51e0790
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/Http/Controllers/Users.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class Users extends \Igniter\Admin\Classes\AdminController
'configFile' => 'user',
];

public $locationConfig = [
public array $locationConfig = [
'addAbsenceConstraint' => false,
];

Expand Down Expand Up @@ -95,6 +95,7 @@ public function account_onSave()
AdminAuth::logout();
return redirect('/logout');
}

if ($usernameChanged || $languageChanged) {
$this->currentUser->reload()->reloadRelations();
AdminAuth::login($this->currentUser, true);
Expand Down
15 changes: 8 additions & 7 deletions src/Requests/UserRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@

class UserRequest extends FormRequest
{

protected function getRecordId()
{
$slugName = ($slug = $this->route('slug'))
? str_after($slug, '/') : null;
return $slugName == 'account' ? AdminAuth::id() : $slugName;
}
public function attributes()
{
return [
Expand Down Expand Up @@ -54,4 +47,12 @@ public function rules()
'locations.*' => ['integer'],
];
}

protected function getRecordId(): string
{
$slugName = ($slug = $this->route('slug'))
? str_after($slug, '/') : null;

return $slugName == 'account' ? AdminAuth::id() : $slugName;
}
}

0 comments on commit 51e0790

Please sign in to comment.