diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 25c9791..d5988ef 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -79,7 +79,8 @@ class UserController extends Controller */ public function edit($id) { - // + $user = User::find($id); + return view('admin.users.edit',['user'=>$user]); } /** @@ -91,7 +92,20 @@ class UserController extends Controller */ public function update(Request $request, $id) { - // + $request->validate([ + 'username' => 'required|string|max:255|unique:users,username,'.$id, + 'name' => 'required|string|max:255', + 'email' => 'required|email|unique:users,email,'.$id, + ]); + + $user = User::find($id); + + $user->username = $request->username; + $user->name = $request->name; + $user->email = $request->email; + $user->save(); + + return redirect(route('users.index')); } /** diff --git a/public/css/app.css b/public/css/app.css index c1b94bd..b2976f2 100644 --- a/public/css/app.css +++ b/public/css/app.css @@ -710,6 +710,15 @@ select { .-ml-px { margin-left: -1px; } +.mt-1 { + margin-top: 0.25rem; +} +.mt-4 { + margin-top: 1rem; +} +.ml-4 { + margin-left: 1rem; +} .ml-1 { margin-left: 0.25rem; } @@ -722,12 +731,6 @@ select { .ml-2 { margin-left: 0.5rem; } -.mt-4 { - margin-top: 1rem; -} -.ml-4 { - margin-left: 1rem; -} .mt-8 { margin-top: 2rem; } @@ -746,9 +749,6 @@ select { .mb-4 { margin-bottom: 1rem; } -.mt-1 { - margin-top: 0.25rem; -} .mt-6 { margin-top: 1.5rem; } @@ -797,6 +797,9 @@ select { .w-5 { width: 1.25rem; } +.w-full { + width: 100%; +} .w-8 { width: 2rem; } @@ -815,15 +818,15 @@ select { .w-20 { width: 5rem; } -.w-full { - width: 100%; -} .max-w-7xl { max-width: 80rem; } .max-w-6xl { max-width: 72rem; } +.max-w-xl { + max-width: 36rem; +} .flex-1 { flex: 1 1 0%; } @@ -912,18 +915,21 @@ select { .border { border-width: 1px; } -.border-t { - border-top-width: 1px; -} .border-b { border-bottom-width: 1px; } +.border-t { + border-top-width: 1px; +} .border-b-2 { border-bottom-width: 2px; } .border-l-4 { border-left-width: 4px; } +.border-r { + border-right-width: 1px; +} .border-gray-300 { --tw-border-opacity: 1; border-color: rgb(209 213 219 / var(--tw-border-opacity)); @@ -943,6 +949,10 @@ select { --tw-border-opacity: 1; border-color: rgb(129 140 248 / var(--tw-border-opacity)); } +.border-gray-400 { + --tw-border-opacity: 1; + border-color: rgb(156 163 175 / var(--tw-border-opacity)); +} .bg-white { --tw-bg-opacity: 1; background-color: rgb(255 255 255 / var(--tw-bg-opacity)); @@ -984,6 +994,10 @@ select { padding-top: 1.5rem; padding-bottom: 1.5rem; } +.py-12 { + padding-top: 3rem; + padding-bottom: 3rem; +} .py-4 { padding-top: 1rem; padding-bottom: 1rem; @@ -996,10 +1010,6 @@ select { padding-top: 0.25rem; padding-bottom: 0.25rem; } -.py-12 { - padding-top: 3rem; - padding-bottom: 3rem; -} .px-1 { padding-left: 0.25rem; padding-right: 0.25rem; @@ -1041,6 +1051,10 @@ select { font-size: 0.875rem; line-height: 1.25rem; } +.text-xl { + font-size: 1.25rem; + line-height: 1.75rem; +} .text-lg { font-size: 1.125rem; line-height: 1.75rem; @@ -1049,10 +1063,6 @@ select { font-size: 1rem; line-height: 1.5rem; } -.text-xl { - font-size: 1.25rem; - line-height: 1.75rem; -} .text-xs { font-size: 0.75rem; line-height: 1rem; @@ -1069,15 +1079,18 @@ select { .leading-5 { line-height: 1.25rem; } -.leading-7 { - line-height: 1.75rem; -} .leading-tight { line-height: 1.25; } +.leading-7 { + line-height: 1.75rem; +} .tracking-widest { letter-spacing: 0.1em; } +.tracking-wider { + letter-spacing: 0.05em; +} .text-gray-500 { --tw-text-opacity: 1; color: rgb(107 114 128 / var(--tw-text-opacity)); @@ -1086,6 +1099,10 @@ select { --tw-text-opacity: 1; color: rgb(55 65 81 / var(--tw-text-opacity)); } +.text-gray-800 { + --tw-text-opacity: 1; + color: rgb(31 41 55 / var(--tw-text-opacity)); +} .text-gray-200 { --tw-text-opacity: 1; color: rgb(229 231 235 / var(--tw-text-opacity)); @@ -1106,10 +1123,6 @@ select { --tw-text-opacity: 1; color: rgb(17 24 39 / var(--tw-text-opacity)); } -.text-gray-800 { - --tw-text-opacity: 1; - color: rgb(31 41 55 / var(--tw-text-opacity)); -} .text-green-600 { --tw-text-opacity: 1; color: rgb(22 163 74 / var(--tw-text-opacity)); diff --git a/resources/views/admin/users/edit.blade.php b/resources/views/admin/users/edit.blade.php new file mode 100644 index 0000000..06f4f7d --- /dev/null +++ b/resources/views/admin/users/edit.blade.php @@ -0,0 +1,54 @@ + + +

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

+
+ +
+
+
+
+ +
+ @csrf + @method('PUT') + + +
+ + + +
+ + +
+ + + +
+ + +
+ + + +
+ +
+ + + {{ __('Save') }} + + +
+
+
+
+
+
+
\ No newline at end of file diff --git a/resources/views/admin/users/list.blade.php b/resources/views/admin/users/list.blade.php index 4805a61..a70219a 100644 --- a/resources/views/admin/users/list.blade.php +++ b/resources/views/admin/users/list.blade.php @@ -20,6 +20,9 @@ {{ __('User name')}} + + {{ __('Name')}} + {{ __('Email')}} @@ -30,6 +33,7 @@ @foreach ( $users as $user) {{ $user->username }} + {{ $user->name }} {{ $user->email }}