From ba7f45c1470c335805b89214ee36f8ca0a10d8ad Mon Sep 17 00:00:00 2001 From: Bahar Date: Wed, 19 Aug 2026 19:22:07 +0330 Subject: [PATCH] feat:complete create edit and index blade for admin permission --- bootstrap/app.php | 1 + resources/views/admin/admins/create.blade.php | 121 +++++--- resources/views/admin/admins/edit.blade.php | 226 +++++++++++++-- resources/views/admin/admins/index.blade.php | 260 ++++++++++++++---- 4 files changed, 500 insertions(+), 108 deletions(-) diff --git a/bootstrap/app.php b/bootstrap/app.php index 0a95f04..aca5f6f 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -20,6 +20,7 @@ return Application::configure(basePath: dirname(__DIR__)) $middleware->alias([ 'admin.permission' => AdminPermissionMiddleware::class, + ]); $middleware->redirectGuestsTo(function (Request $request) { diff --git a/resources/views/admin/admins/create.blade.php b/resources/views/admin/admins/create.blade.php index d2fc28c..1fa90b7 100644 --- a/resources/views/admin/admins/create.blade.php +++ b/resources/views/admin/admins/create.blade.php @@ -109,64 +109,113 @@ @enderror - {{-- Permissions --}}
- {{-- Header --}}
دسترسی‌های مدیر
- {{-- Body --}}
- @foreach($permissions as $permission) +
+
-
+ -
- - id, - old('permissions', []) - ) - ) - > - - - -
+
+
- @endforeach + +
+
+ + + + + +
+
+ + +
+
+ + + + + +
+
+ + +
+
+ + + + + +
+
- @error('permissions') -
- {{ $message }} -
- @enderror -
diff --git a/resources/views/admin/admins/edit.blade.php b/resources/views/admin/admins/edit.blade.php index 3284ae0..4dac2bb 100644 --- a/resources/views/admin/admins/edit.blade.php +++ b/resources/views/admin/admins/edit.blade.php @@ -6,8 +6,12 @@
@@ -19,68 +23,94 @@
-
+ + + @csrf @method('PUT')
+
ویرایش مدیر
+ + {{-- اطلاعات مدیر --}}
+
- + @error('first_name')
{{ $message }}
@enderror
+
- + @error('last_name')
{{ $message }}
@enderror
+
- + @error('username')
{{ $message }}
@enderror
+
- + @error('email')
{{ $message }}
@enderror
+
- + + + @error('password')
{{ $message }}
@enderror @@ -92,12 +122,14 @@ admin_view + ) + ) + > + + + +
+ +
+ + + {{-- ایجاد مدیر --}} +
+ +
+ + admin_create + ) + ) + > + + + +
+ +
+ + + {{-- ویرایش مدیر --}} +
+ +
+ + admin_edit + ) + ) + > + + + +
+ +
+ + + {{-- حذف مدیر --}} +
+ +
+ + admin_delete + ) + ) + > + + + +
+ +
+ +
+ +
+ +
+
+ +
+ + diff --git a/resources/views/admin/admins/index.blade.php b/resources/views/admin/admins/index.blade.php index 88dd3ef..cbec34f 100644 --- a/resources/views/admin/admins/index.blade.php +++ b/resources/views/admin/admins/index.blade.php @@ -1,86 +1,164 @@ @extends('admin.layouts.app') + @section('breadcrumb')

لیست ادمین‌ها

+
@endsection + + @section('content') +
- + {{-- فیلتر و جستجو --}}
+
+
+
+ action="{{ route('admin.admins.index') }}"> +
- + {{-- جستجو و مرتب سازی --}}
+
- - + + + + +
- + + + + - - + +
- - + + {{-- ایجاد مدیر --}} + @if(auth('admin')->user()->permission?->admin_create) + + + + @endif
+
+
+
+
-
+
+
+
+ + + - + + + @@ -88,67 +166,139 @@ + + + + + @foreach($admins as $admin) + + - - - - - + + + + + + + + + - + + + + @endforeach + +
+ + نام نام خانوادگی نام کاربریوضعیت تاریخ ایجاد اقدامات
- + + + {{ $admin->first_name }}{{ $admin->last_name }}{{ $admin->username }}{{ $admin->email }} + {{ $admin->first_name }} + + {{ $admin->last_name }} + + {{ $admin->username }} + + {{ $admin->email }} + + @switch($admin->status) @case(\App\Enums\AdminStatus::ENABLE) - فعال + + + فعال + + @break @case(\App\Enums\AdminStatus::DISABLE) - غیرفعال + + + غیرفعال + + @break @endswitch + {{ $admin->created_at->toJalali()->format('H:i Y/m/d') }} -
- - - -
- @csrf - @method('DELETE') - - -
-
+ {{ $admin->created_at->toJalali()->format('H:i Y/m/d') }}
+ +
+ + @if(auth('admin')->user()->permission?->admin_edit) + + + + + + @endif + + @if(auth('admin')->user()->permission?->admin_delete) + +
+ + @csrf + @method('DELETE') + + + +
+ + @endif + +
+ +
+
+
+
+
-
+ {{ $admins->links() }} +
+ +
+ @endsection