From a4ad8de17e5195438be77ff5ce2621af2ed4487c Mon Sep 17 00:00:00 2001 From: raccoon254 Date: Mon, 24 Jun 2024 10:54:12 +0300 Subject: [PATCH] Middleware can manage for seeing users etc --- resources/views/livewire/user-edit.blade.php | 95 ++++++++++++-------- routes/web.php | 8 +- 2 files changed, 61 insertions(+), 42 deletions(-) diff --git a/resources/views/livewire/user-edit.blade.php b/resources/views/livewire/user-edit.blade.php index 93d98f7..22e0e01 100644 --- a/resources/views/livewire/user-edit.blade.php +++ b/resources/views/livewire/user-edit.blade.php @@ -1,45 +1,64 @@ -
- @if (session()->has('message')) - - @endif +
+ +

+ + {{ __('Edit User') }} +

+
-
-
-
- - - @error('name') {{ $message }} @enderror -
+
+
+
+ @if (session()->has('message')) + + @endif -
- - - @error('phone') {{ $message }} @enderror -
+ +
+
+ + + @error('name') {{ $message }} @enderror +
-
- - - @error('location') {{ $message }} @enderror -
+
+ + + @error('phone') {{ $message }} @enderror +
-
- - - @error('role') {{ $message }} @enderror -
-
+
+ + + @error('location') {{ $message }} @enderror +
-
- +
+ + + @error('role') {{ $message }} @enderror +
+
+ +
+ +
+ +
- +
diff --git a/routes/web.php b/routes/web.php index a542fc1..760bcc3 100644 --- a/routes/web.php +++ b/routes/web.php @@ -45,11 +45,11 @@ Route::view('/referrals', 'static.coming-soon')->name('referrals'); Route::get('/payments', VerifyPayments::class)->name('payments.index'); - Route::get('/users', ManageUsers::class)->name('users.index'); - Route::get('/users/{user}', [ManageUsers::class, 'show'])->name('users.show'); - Route::get('/users/edit/{id}', UserEdit::class)->name('users.edit'); + Route::get('/users', ManageUsers::class)->name('users.index')->middleware('can:manage'); + Route::get('/users/{user}', [ManageUsers::class, 'show'])->name('users.show')->middleware('can:manage'); + Route::get('/users/edit/{id}', UserEdit::class)->name('users.edit')->middleware('can:manage'); - Route::get('/payments/{paymentId}', VerifyOrderPayment::class)->name('payments.show'); + Route::get('/payments/{paymentId}', VerifyOrderPayment::class)->name('payments.show')->middleware('can:manage'); }); Route::get('/contact', [PagesController::class, 'contact'])->name('contact');