Added button to remove profile picture

This commit is contained in:
Julian Prieber 2023-01-23 17:19:09 +01:00
parent c0c4397cd8
commit 590f5b45ad
3 changed files with 17 additions and 3 deletions

View File

@ -669,6 +669,19 @@ class UserController extends Controller
return redirect('/'); return redirect('/');
} }
//Delete profile picture
public function delProfilePicture()
{
$user_id = Auth::user()->id;
$path = base_path('img/' . $user_id . '.png');
if (File::exists($path)) {
File::delete($path);
}
return back();
}
//Edit/save page icons //Edit/save page icons
public function editIcons(request $request) public function editIcons(request $request)
{ {

View File

@ -26,7 +26,7 @@
@csrf @csrf
@if($page->littlelink_name != '') @if($page->littlelink_name != '')
<div class="form-group col-lg-8"> <div class="form-group col-lg-8">
<label>Logo</label> <label>Logo</label>@if(file_exists(base_path("img/" . Auth::user()->id . ".png")))<a title="Remove icon" class="hvr-grow p-1 text-danger" style="padding-left:5px;" href="{{ route('delProfilePicture') }}"><i class="bi bi-trash-fill"></i></a>@endif
<input type="file" accept="image/jpeg,image/jpg,image/png" class="form-control-file" name="image"> <input type="file" accept="image/jpeg,image/jpg,image/png" class="form-control-file" name="image">
</div> </div>
@endif @endif
@ -58,7 +58,7 @@
<div class="input-group-prepend"> <div class="input-group-prepend">
<div class="input-group-text">{{ url('') }}/@</div> <div class="input-group-text">{{ url('') }}/@</div>
</div> </div>
<input type="text" class="form-control" name="pageName" value="{{ $page->littlelink_name ?? '' }}" required> <input type="text" class="form-control" name="littlelink_name" value="{{ $page->littlelink_name ?? '' }}" required>
</div> </div>
<label style="margin-top:15px">Display name</label> <label style="margin-top:15px">Display name</label>
@ -66,7 +66,7 @@
{{-- <div class="input-group-prepend"> {{-- <div class="input-group-prepend">
<div class="input-group-text">Name:</div> <div class="input-group-text">Name:</div>
</div> --}} </div> --}}
<input type="text" class="form-control" name="Name" value="{{ $page->name }}" required> <input type="text" class="form-control" name="name" value="{{ $page->name }}" required>
</div> </div>
</div> </div>

View File

@ -117,6 +117,7 @@ Route::get('/studio/profile', [UserController::class, 'showProfile'])->name('sho
Route::post('/studio/profile', [UserController::class, 'editProfile'])->name('editProfile'); Route::post('/studio/profile', [UserController::class, 'editProfile'])->name('editProfile');
Route::post('/edit-icons', [UserController::class, 'editIcons'])->name('editIcons'); Route::post('/edit-icons', [UserController::class, 'editIcons'])->name('editIcons');
Route::get('/clearIcon/{id}', [UserController::class, 'clearIcon'])->name('clearIcon'); Route::get('/clearIcon/{id}', [UserController::class, 'clearIcon'])->name('clearIcon');
Route::get('/studio/page/delprofilepicture', [UserController::class, 'delProfilePicture'])->name('delProfilePicture');
Route::get('/studio/delete-user/{id}', [UserController::class, 'deleteUser'])->name('deleteUser')->middleware('verified'); Route::get('/studio/delete-user/{id}', [UserController::class, 'deleteUser'])->name('deleteUser')->middleware('verified');
Route::get('/studio/linkparamform_part/{typeid}/{linkid}', [LinkTypeViewController::class, 'getParamForm'])->name('linkparamform.part'); Route::get('/studio/linkparamform_part/{typeid}/{linkid}', [LinkTypeViewController::class, 'getParamForm'])->name('linkparamform.part');
}); });