git add .

git commit "implement user management with search sort permissions and safe delete"
This commit is contained in:
2026-08-18 15:18:57 +03:30
parent bff0c7ea4d
commit 0722cf3120
10 changed files with 564 additions and 17 deletions
+214 -3
View File
@@ -1,3 +1,214 @@
<div>
<!-- Simplicity is the essence of happiness. - Cedric Bledsoe -->
</div>
@extends('admin.layouts.app')
@section('breadcrumb')
<span>
مدیریت کاربران
</span>
@endsection
@section('content')
<div class="container mt-4">
<div class="card shadow-sm mb-3">
<div class="card-body">
<form method="GET"
action="{{ route('admin.users.index') }}">
<div class="row g-2">
<div class="col-md-8">
<input
type="text"
name="keyword"
value="{{ request('keyword') }}"
class="form-control"
placeholder="جستجو نام، ایمیل، موبایل..."
>
</div>
<div class="col-md-3">
<select
class="form-control"
name="sort"
onchange="this.form.submit()"
>
<option value="">
مرتب‌سازی بر اساس
</option>
<option value="first_name_asc"
{{ request('sort') == 'first_name_asc' ? 'selected' : '' }}>
نام (الف - ی)
</option>
<option value="first_name_desc"
{{ request('sort') == 'first_name_desc' ? 'selected' : '' }}>
نام (ی - الف)
</option>
<option value="newest"
{{ request('sort') == 'newest' ? 'selected' : '' }}>
جدیدترین
</option>
</select>
</div>
<div class="col-md-2">
<button class="btn btn-primary w-100">
جستجو
</button>
</div>
@if(request('keyword'))
<div class="col-md-2">
<a href="{{ route('admin.users.index') }}"
class="btn btn-secondary w-100">
پاک کردن
</a>
</div>
@endif
</div>
</form>
</div>
</div>
<div class="card shadow">
<div class="card-body">
<table class="table table-bordered text-center align-middle">
<thead class="table-light">
<tr>
<th>شناسه</th>
<th>نام</th>
<th>نام خانوادگی</th>
<th>ایمیل</th>
<th>موبایل</th>
<th>عملیات</th>
</tr>
</thead>
<tbody>
@forelse($users as $user)
<tr>
<td>
{{ $user->id }}
</td>
<td>
{{ $user->first_name }}
</td>
<td>
{{ $user->last_name }}
</td>
<td>
{{ $user->email }}
</td>
<td>
{{ $user->mobile }}
</td>
<td>
<a href="{{ route('admin.users.edit',$user->id) }}"
class="btn btn-sm btn-warning">
ویرایش
</a>
<form action="{{ route('admin.users.destroy',$user->id) }}"
method="POST"
class="d-inline">
@csrf
@method('DELETE')
<button class="btn btn-sm btn-danger"
onclick="return confirm('حذف شود؟')">
حذف
</button>
</form>
</td>
</tr>
@empty
<tr>
<td colspan="6">
کاربری یافت نشد
</td>
</tr>
@endforelse
</tbody>
</table>
{{ $users->links() }}
</div>
</div>
</div>
@endsection