From d59affd0f72585e49a49da6a7e32fd5e02c86c78 Mon Sep 17 00:00:00 2001 From: Dharma Date: Thu, 4 Apr 2024 14:04:00 +0545 Subject: [PATCH] user controller added --- app/Http/Controllers/Usercontroller.php | 5 +- app/View/Components/application-logo.php | 26 -------- app/View/Components/auth-session-status.php | 26 -------- resources/views/users/create.blade.php | 67 +++++++++++++++++++++ resources/views/users/index.blade.php | 55 +++++++++++++++++ routes/web.php | 2 + 6 files changed, 127 insertions(+), 54 deletions(-) delete mode 100644 app/View/Components/application-logo.php delete mode 100644 app/View/Components/auth-session-status.php create mode 100644 resources/views/users/create.blade.php create mode 100644 resources/views/users/index.blade.php diff --git a/app/Http/Controllers/Usercontroller.php b/app/Http/Controllers/Usercontroller.php index 6d35cde..749d1cd 100644 --- a/app/Http/Controllers/Usercontroller.php +++ b/app/Http/Controllers/Usercontroller.php @@ -29,9 +29,10 @@ class UserController extends Controller return redirect()->route('users.index'); } - public function index(UsersDataTable $dataTables) + public function index() { - return $dataTables->render('users.index'); + $users = User::latest()->get(); + return view('users.index', compact('users')); } public function destroy(string $id) diff --git a/app/View/Components/application-logo.php b/app/View/Components/application-logo.php deleted file mode 100644 index fa70ace..0000000 --- a/app/View/Components/application-logo.php +++ /dev/null @@ -1,26 +0,0 @@ - +
+

Create User

+
+
+
+
Add New User
+ Back +
+ +
+
+
+ @csrf +
+
+
+ + +
+
+
+ +
+
+
+ + +
+
+
+ +
+
+
+ + +
+
+
+ +
+
+
+ + +
+
+
+ +
+
+ +
+
+
+
+
+
+ +@endsection diff --git a/resources/views/users/index.blade.php b/resources/views/users/index.blade.php new file mode 100644 index 0000000..df05f2d --- /dev/null +++ b/resources/views/users/index.blade.php @@ -0,0 +1,55 @@ +@extends('layouts.app') +@section('content') +
+
+

List users

+
+
+
+ @can('create users') + New User + @endcan +
+ +
+
+ + + + + + + + + + @can('access users') + @foreach ($users as $permission) + + + + + + @endforeach + @endcan + +
S.NNameAction
{{ $permission->id }}{{ $permission->name }} + @can('edit users') + + @endcan + @can('delete users') +
+ @csrf + @method('delete') + +
+ @endcan +
+
+
+
+
+@endsection diff --git a/routes/web.php b/routes/web.php index b6eb592..5278a05 100644 --- a/routes/web.php +++ b/routes/web.php @@ -2,6 +2,7 @@ use App\Http\Controllers\PermissionController; use App\Http\Controllers\RoleController; +use App\Http\Controllers\UserController; use Illuminate\Support\Facades\Route; /* @@ -25,3 +26,4 @@ Route::get('/dashboard', [App\Http\Controllers\HomeController::class, 'index'])- Route::resource('roles', RoleController::class)->names('roles'); Route::resource('permissions', PermissionController::class)->names('permissions'); +Route::resource('users', UserController::class)->names('users');