Node and user API routes implemented.
More attempts at the logic for API permissions, most likely will need continued tweaking in the future, but base is there.
This commit is contained in:
parent
f24b238e30
commit
820d2bf172
15 changed files with 447 additions and 26 deletions
|
@ -136,26 +136,26 @@ class UserController extends Controller
|
|||
* Update a user.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $user
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function updateUser(Request $request, $user)
|
||||
public function updateUser(Request $request, $id)
|
||||
{
|
||||
try {
|
||||
$repo = new UserRepository;
|
||||
$repo->update($user, $request->only([
|
||||
$user = $repo->update($user, $request->intersect([
|
||||
'email', 'password', 'name_first',
|
||||
'name_last', 'username', 'root_admin',
|
||||
]));
|
||||
Alert::success('User account was successfully updated.')->flash();
|
||||
} catch (DisplayValidationException $ex) {
|
||||
return redirect()->route('admin.users.view', $user)->withErrors(json_decode($ex->getMessage()));
|
||||
} catch (\Exception $e) {
|
||||
Log::error($e);
|
||||
return redirect()->route('admin.users.view', $id)->withErrors(json_decode($ex->getMessage()));
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
Alert::danger('An error occured while attempting to update this user.')->flash();
|
||||
}
|
||||
|
||||
return redirect()->route('admin.users.view', $user);
|
||||
return redirect()->route('admin.users.view', $id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue