mirror of
https://github.com/LinkStackOrg/LinkStack.git
synced 2025-02-16 12:00:50 +01:00
Added option for admins to view and delete user links
This commit is contained in:
parent
dfe0a0326b
commit
2dc3e3d185
@ -94,6 +94,27 @@ class AdminController extends Controller
|
||||
|
||||
}
|
||||
|
||||
//Show link, click number, up link in links page
|
||||
public function showLinksUser(request $request)
|
||||
{
|
||||
$id = $request->id;
|
||||
|
||||
$data['user'] = User::where('id', $id)->get();
|
||||
|
||||
$data['links'] = Link::select('id', 'link', 'title', 'order', 'click_number', 'up_link', 'links.button_id')->where('user_id', $id)->orderBy('up_link', 'asc')->orderBy('order', 'asc')->paginate(10);
|
||||
return view('panel/links', $data);
|
||||
}
|
||||
|
||||
//Delete link
|
||||
public function deleteLinkUser(request $request)
|
||||
{
|
||||
$linkId = $request->id;
|
||||
|
||||
Link::where('id', $linkId)->delete();
|
||||
|
||||
return back();
|
||||
}
|
||||
|
||||
//Save user edit
|
||||
public function editUser(request $request)
|
||||
{
|
||||
|
36
resources/views/panel/links.blade.php
Normal file
36
resources/views/panel/links.blade.php
Normal file
@ -0,0 +1,36 @@
|
||||
@extends('layouts.sidebar')
|
||||
|
||||
@section('content')
|
||||
|
||||
<h2 class="mb-4"><i class="bi bi-link-45deg"> Links</i></h2>
|
||||
|
||||
<div style="overflow-y: auto;">
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Link</th>
|
||||
<th scope="col">Title</th>
|
||||
<th scope="col">Click</th>
|
||||
<th scope="col">Delete</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($links as $link)
|
||||
<tr>
|
||||
<td title="{{ $link->link }}">{{ Str::limit($link->link, 30) }}</td>
|
||||
<td title="{{ $link->title }}">{{ Str::limit($link->title, 30) }}</td>
|
||||
<td class="text-right">{{ $link->click_number }}</td>
|
||||
<td><a href="{{ route('deleteLinkUser', $link->id ) }}" class="text-danger">Delete</a></td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<ul class="pagination justify-content-center">
|
||||
{!! $links ?? ''->links() !!}
|
||||
</ul>
|
||||
|
||||
<a class="btn btn-primary" href="{{ url('/panel/users/all') }}">⬅ Back</a>
|
||||
|
||||
@endsection
|
@ -24,6 +24,7 @@
|
||||
<th scope="col">Page</th>
|
||||
<th scope="col">Role</th>
|
||||
<th scope="col">Edit</th>
|
||||
<th scope="col">Buttons</th>
|
||||
<th scope="col">Block</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -34,6 +35,7 @@
|
||||
<td><a href="{{ url('') }}/@<?= $user->littlelink_name ?>" target="_blank" class="text-info"><i class="bi bi-box-arrow-up-right"></i> {{ $user->littlelink_name }} </a></td>
|
||||
<td>{{ $user->role }}</td>
|
||||
<td><a href="{{ route('editUser', $user->id ) }}">Edit</a></td>
|
||||
<td><a href="{{ route('showLinksUser', $user->id ) }}">View</a></td>
|
||||
<td><a href="{{ route('blockUser', ['block' => $user->block, 'id' => $user->id] ) }}" class="text-danger">{{ $user->block }}</a></td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
@ -73,6 +73,8 @@ URL::forceScheme('https'); # comment to disable https
|
||||
Route::get('/panel/index', [AdminController::class, 'index'])->name('panelIndex');
|
||||
Route::get('/panel/users/{type}', [AdminController::class, 'users'])->name('showUsers');
|
||||
Route::post('/panel/users/{name?}', [AdminController::class, 'searchUser'])->name('searchUser');
|
||||
Route::get('/panel/links/{id}', [AdminController::class, 'showLinksUser'])->name('showLinksUser');
|
||||
Route::get('/panel/deleteLink/{id}', [AdminController::class, 'deleteLinkUser'])->name('deleteLinkUser');
|
||||
Route::get('/panel/users/block/{block}/{id}', [AdminController::class, 'blockUser'])->name('blockUser');
|
||||
Route::get('/panel/edit-user/{id}', [AdminController::class, 'showUser'])->name('showUser');
|
||||
Route::post('/panel/edit-user/{id}', [AdminController::class, 'editUser'])->name('editUser');
|
||||
|
Loading…
x
Reference in New Issue
Block a user