YoLo
This commit is contained in:
parent
f3596ce761
commit
aa4b623978
2 changed files with 18 additions and 0 deletions
|
@ -145,4 +145,21 @@ class AdminController extends BaseController
|
|||
|
||||
return $response->withData($invites);
|
||||
}
|
||||
|
||||
public function inviteNew(Request $request, Response $response) {
|
||||
if(!Auth::user()->admin) {
|
||||
throw new HTTPException("Need Admin Access");
|
||||
}
|
||||
|
||||
$invite = new Invite();
|
||||
$invite->user_id = Auth::user()->id;
|
||||
$invite->username = $request->input("username", null);
|
||||
$invite->comment = $request->input("comment", null);
|
||||
$invite->status = "active";
|
||||
$invite->createToken();
|
||||
$invite->saveOrFail();
|
||||
|
||||
|
||||
return $response->withData($invite);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,6 +93,7 @@ $router->group(['prefix' => 'api'], function () use ($router) {
|
|||
$router->put("/app/{id}/properties", ["uses" => "API\AdminController@saveAppProperties"]);
|
||||
$router->group(['prefix' => 'invite'], function () use ($router) {
|
||||
$router->get("", ["uses" => "API\AdminController@listInvites"]);
|
||||
$router->post("", ["uses" => "API\AdminController@inviteNew"]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Reference in a new issue