mirror of
https://koodu.h-i.works/projects/thebadspace
synced 2025-06-25 16:04:37 -05:00
added member edit admin ui
needed way to edit existing members info if needed, so simple ui was created for admins of the site to change specific info, not including a members avi or password. also consolidated memeber action and ui into it's own controller for the sake of clearer organization
This commit is contained in:
@ -14,6 +14,11 @@ class MemberRepository
|
||||
$this->model = $model;
|
||||
}
|
||||
|
||||
public function getAll()
|
||||
{
|
||||
return $this->model::all();
|
||||
}
|
||||
|
||||
public function get($uuid)
|
||||
{
|
||||
return $this->model::where("uuid", $uuid)->first();
|
||||
@ -24,6 +29,38 @@ class MemberRepository
|
||||
//get member to edit
|
||||
$member = $this->get($request->id);
|
||||
|
||||
//save new avi if available
|
||||
$publicPath = '../public/';
|
||||
$refPath = 'assets/images/members/' . $member->uuid;
|
||||
if ($request->hasfile("fresh_avi")) {
|
||||
$file = $request->fresh_avi;
|
||||
if (!is_dir($publicPath . $refPath)) {
|
||||
mkdir($publicPath . $refPath, 0755, true);
|
||||
}
|
||||
$filename = urlencode($file->getClientOriginalName());
|
||||
$file->move($publicPath . $refPath, $filename);
|
||||
$freshAvi = '/' . $refPath . '/' . $filename;
|
||||
$member->avatar = $freshAvi;
|
||||
}
|
||||
|
||||
$member->handle = $request->handle;
|
||||
$member->email = $request->email;
|
||||
$member->pronoun = $request->pronouns;
|
||||
$member->role = $request->role;
|
||||
$member->active = $request->status;
|
||||
|
||||
if ($member->save()) {
|
||||
return ['status' => true, 'message' => "Member Editited"];
|
||||
} else {
|
||||
return ['status' => false, 'message' => "Member Not Editited"];
|
||||
}
|
||||
}
|
||||
|
||||
public function editProfile($request)
|
||||
{
|
||||
//get member to edit
|
||||
$member = $this->get($request->id);
|
||||
|
||||
//save new avi if available
|
||||
$publicPath = '../public/';
|
||||
$refPath = 'assets/images/members/' . $member->uuid;
|
||||
|
Reference in New Issue
Block a user