diff --git a/app/Http/Controllers/AdminController.php b/app/Http/Controllers/AdminController.php
index 1e2b9ab..05e2193 100755
--- a/app/Http/Controllers/AdminController.php
+++ b/app/Http/Controllers/AdminController.php
@@ -223,6 +223,21 @@ public function SendTestMail(Request $request)
return redirect('admin/users/all');
}
+ //Delete existing user with POST request
+ public function deleteTableUser(request $request)
+ {
+ $id = $request->id;
+
+ Link::where('user_id', $id)->delete();
+
+ Schema::disableForeignKeyConstraints();
+
+ $user = User::find($id);
+ $user->forceDelete();
+
+ Schema::enableForeignKeyConstraints();
+ }
+
//Show user to edit
public function showUser(request $request)
{
diff --git a/app/Http/Livewire/UserTable.php b/app/Http/Livewire/UserTable.php
new file mode 100644
index 0000000..cf9dfab
--- /dev/null
+++ b/app/Http/Livewire/UserTable.php
@@ -0,0 +1,127 @@
+setPrimaryKey('id');
+ $this->setPerPageAccepted([50, 100, 250, 500, 1000, -1]);
+ $this->setColumnSelectEnabled();
+ }
+
+ public function columns(): array
+ {
+ return [
+ Column::make(__('messages.ID'), "id")
+ ->sortable()
+ ->searchable(),
+ Column::make(__('messages.Name'), "name")
+ ->sortable()
+ ->searchable(),
+ Column::make(__('messages.E-Mail'), "email")
+ ->sortable()
+ ->searchable(),
+ Column::make(__('messages.Page'), "littlelink_name")
+ ->sortable()
+ ->searchable()
+ ->format(function ($value, $row, Column $column) {
+ if (!$row->littlelink_name == NULL) {
+ return "littlelink_name . "' target='_blank' class='text-info'> " . $row->littlelink_name . " ";
+ } else {
+ return 'N/A';
+ }
+ })
+ ->html(),
+ Column::make(__('messages.Role'), "role")
+ ->sortable()
+ ->searchable(),
+ Column::make(__('messages.Links'), "id")
+ ->format(function ($value, $row) {
+ $linkCount = Link::where('user_id', $row->id)->count();
+ return $linkCount;
+ }),
+ Column::make(__('messages.Clicks'), "id")
+ ->format(function ($value, $row) {
+ $clicksSum = Link::where('user_id', $row->id)->sum('click_number');
+ return $clicksSum;
+ }),
+ Column::make(__('messages.E-Mail'), "email_verified_at")
+ ->sortable()
+ ->format(function ($value, $row, Column $column) {
+ if (env('REGISTER_AUTH') !== 'auth') {
+ if ($row->role == 'admin' && $row->email_verified_at != '') {
+ return '
-';
+ } else {
+ $verifyLink = route('verifyUser', [
+ 'verify' => '-' . $row->email_verified_at,
+ 'id' => $row->id
+ ]);
+ if ($row->email_verified_at == '') {
+ return '' . __('messages.Pending') . '';
+ } else {
+ return '' . __('messages.Verified') . '';
+ }
+ }
+ } else {
+ return '-';
+ }
+ return '';
+ })->html(),
+ Column::make(__('messages.Status'), "block")
+ ->sortable()
+ ->format(function ($value, $row, Column $column) {
+ if ($row->role === 'admin' && $row->id === 1) {
+ return '-';
+ } else {
+ $route = route('blockUser', ['block' => $row->block, 'id' => $row->id]);
+ if ($row->block === 'yes') {
+ $badge = ''.__('messages.Pending').'';
+ } elseif ($row->block === 'no') {
+ $badge = ''.__('messages.Approved').'';
+ }
+ return "$badge";
+ }
+ })
+ ->html(),
+ Column::make(__('messages.Created at'), "created_at")
+ ->sortable()
+ ->format(function ($value) {
+ if ($value) {
+ return $value->format('d/m/y');
+ } else {
+ return '';
+ }
+ }),
+ Column::make(__('messages.Last seen'), "updated_at")
+ ->sortable()
+ ->format(function ($value) {
+ $now = now();
+ $diff = $now->diff($value);
+
+ if ($diff->d < 1 && $diff->h < 1) {
+ return 'Now';
+ } elseif ($diff->d < 1 && $diff->h < 24) {
+ return $diff->h . ' hours ago';
+ } elseif ($diff->d < 365) {
+ return $diff->d . ' days ago';
+ } else {
+ return $diff->y . ' years ago';
+ }
+ }),
+ Column::make(__('messages.Action'), "id")
+ ->format(function ($value, $row, Column $column) {
+ return view('components.table-components.action', ['user' => $row]);
+ }),
+ ];
+ }
+}
diff --git a/app/Providers/LivewireServiceProvider.php b/app/Providers/LivewireServiceProvider.php
new file mode 100644
index 0000000..c09c807
--- /dev/null
+++ b/app/Providers/LivewireServiceProvider.php
@@ -0,0 +1,14 @@
+ $assetUrl]);
+ }
+}
\ No newline at end of file
diff --git a/assets/js/cdn.min.js b/assets/js/cdn.min.js
new file mode 100644
index 0000000..922cc02
--- /dev/null
+++ b/assets/js/cdn.min.js
@@ -0,0 +1,5 @@
+(()=>{var Ze=!1,Qe=!1,H=[],et=-1;function zt(e){En(e)}function En(e){H.includes(e)||H.push(e),vn()}function we(e){let t=H.indexOf(e);t!==-1&&t>et&&H.splice(t,1)}function vn(){!Qe&&!Ze&&(Ze=!0,queueMicrotask(Sn))}function Sn(){Ze=!1,Qe=!0;for(let e=0;ee.effect(t,{scheduler:r=>{tt?zt(r):r()}}),rt=e.raw}function nt(e){I=e}function qt(e){let t=()=>{};return[n=>{let i=I(n);return e._x_effects||(e._x_effects=new Set,e._x_runEffects=()=>{e._x_effects.forEach(o=>o())}),e._x_effects.add(i),t=()=>{i!==void 0&&(e._x_effects.delete(i),L(i))},i},()=>{t()}]}function q(e,t,r={}){e.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,composed:!0,cancelable:!0}))}function O(e,t){if(typeof ShadowRoot=="function"&&e instanceof ShadowRoot){Array.from(e.children).forEach(i=>O(i,t));return}let r=!1;if(t(e,()=>r=!0),r)return;let n=e.firstElementChild;for(;n;)O(n,t,!1),n=n.nextElementSibling}function v(e,...t){console.warn(`Alpine Warning: ${e}`,...t)}var Ut=!1;function Wt(){Ut&&v("Alpine has already been initialized on this page. Calling Alpine.start() more than once can cause problems."),Ut=!0,document.body||v("Unable to initialize. Trying to load Alpine before `` is available. Did you forget to add `defer` in Alpine's `
-
@stack('sidebar-scripts')
diff --git a/resources/views/panel/users.blade.php b/resources/views/panel/users.blade.php
index 3484957..a18a0f2 100755
--- a/resources/views/panel/users.blade.php
+++ b/resources/views/panel/users.blade.php
@@ -4,7 +4,9 @@
@section('content')
-
+
@@ -19,143 +21,100 @@
-
-
- {{__('messages.Users:')}}
-
All -
-
User -
-
Vip -
-
Admin
-
-
-
-
-
- {{__('messages.ID')}} |
- {{__('messages.Name')}} |
- {{__('messages.E-Mail')}} |
- {{__('messages.Page')}} |
- {{__('messages.Role')}} |
- {{__('messages.Links')}} |
- {{__('messages.Clicks')}} |
- {{__('messages.Created at')}} |
- {{__('messages.Last seen')}} |
- @if(env('REGISTER_AUTH') !== 'auth'){{__('messages.E-Mail')}} | @endif
- {{__('messages.Status')}} |
- {{__('messages.Action')}} |
-
-
-
- @foreach($users as $user)
- @php
- $dateFormat = __('messages.date.format');
-
- $date = date($dateFormat, strtotime($user->created_at));
- if(!isset($user->created_at)){$date = __('messages.N/A');}
-
- $lastSeen = $user->updated_at;
- $lastSeenDate = date($dateFormat, strtotime($lastSeen));
- $timezone = new DateTimeZone(date_default_timezone_get());
- $datetime = new DateTime($lastSeen, $timezone);
- $now = new DateTime(null, $timezone);
- $interval = $now->diff($datetime);
- $daysAgo = $interval->days." ".__('messages.days ago');
- if($interval->days == 1) $daysAgo = __('messages.1 day ago');
- if($interval->days == 0) $daysAgo = __('messages.Today');
- if ($interval->days >= 365) {
- $yearsAgo = floor($interval->days / 365);
- if ($yearsAgo == 1) {
- $daysAgo = __('messages.1 year ago');
- } else {
- $daysAgo = $yearsAgo . __('messages.years ago');
- }}
- @endphp
-
- {{ $user->id }} |
- {{ $user->name }} |
- {{ $user->email }} |
- @if(isset($user->littlelink_name)) {{ $user->littlelink_name }} @else {{__('messages.N/A')}} @endif |
- {{ $user->role }} |
- {{$user->links}} |
- {{$user->clicks}} |
- {{$date}} |
- {{$daysAgo}} |
- @if(env('REGISTER_AUTH') !== 'auth')
- @if($user->role == 'admin' and $user->email_verified_at != '')- @else
- @if($user->email_verified_at == ''){{__('messages.Pending')}}@else{{__('messages.Verified')}}@endif |
- @endif
- @endif
- @if($user->role == 'admin' and $user->id == 1)-@else@if($user->block == 'yes') {{__('messages.Pending')}} @elseif($user->block == 'no') {{__('messages.Approved')}} @endif@endif |
-
- @if($user->role == 'admin' and $user->id == 1)-
- @else
-
- @endif
- |
-
- @endforeach
-
-
-
+
+
+
+ {{__('messages.Add new user')}}
-
-
+
+
+
+
@@ -169,53 +128,14 @@
+@push('sidebar-stylesheets')
+
+
+@endpush
+
@push('sidebar-scripts')
-
+
+
@endpush
@endsection
\ No newline at end of file
diff --git a/routes/web.php b/routes/web.php
index 2bf9c4d..dfdd54b 100755
--- a/routes/web.php
+++ b/routes/web.php
@@ -171,6 +171,7 @@ Route::group([
Route::post('/admin/edit-user/{id}', [AdminController::class, 'editUser'])->name('editUser');
Route::get('/admin/new-user', [AdminController::class, 'createNewUser'])->name('createNewUser')->middleware('max.users');
Route::get('/admin/delete-user/{id}', [AdminController::class, 'deleteUser'])->name('deleteUser');
+ Route::post('/admin/delete-table-user/{id}', [AdminController::class, 'deleteTableUser'])->name('deleteTableUser');
Route::get('/admin/pages', [AdminController::class, 'showSitePage'])->name('showSitePage');
Route::post('/admin/pages', [AdminController::class, 'editSitePage'])->name('editSitePage');
Route::get('/admin/advanced-config', [AdminController::class, 'showFileEditor'])->name('showFileEditor');