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
@@ -39,6 +39,14 @@
</a>
</li>
<li class="nav-item mb-2">
<a href="{{ route('admin.users.index') }}"
class="nav-link text-white"
>
لیست کاربران
</a>
</li>
<li class="nav-item mb-2">
<a href="{{ route('admin.tours.index') }}"
@@ -1,3 +0,0 @@
<div>
<!-- Live as if you were to die tomorrow. Learn as if you were to live forever. - Mahatma Gandhi -->
</div>
+157 -3
View File
@@ -1,3 +1,157 @@
<div>
<!-- Let all your things have their places; let each part of your business have its time. - Benjamin Franklin -->
</div>
@extends('admin.layouts.app')
@section('breadcrumb')
<span>
ویرایش کاربر
</span>
@endsection
@section('content')
<div class="container mt-4">
<div class="card shadow">
<div class="card-body">
<form method="POST"
action="{{ route('admin.users.update',$user->id) }}">
@csrf
@method('PUT')
<div class="row">
<div class="col-md-6 mb-3">
<label>
نام
</label>
<input
class="form-control"
name="first_name"
value="{{ old('first_name',$user->first_name) }}">
</div>
<div class="col-md-6 mb-3">
<label>
نام خانوادگی
</label>
<input
class="form-control"
name="last_name"
value="{{ old('last_name',$user->last_name) }}">
</div>
<div class="col-md-6 mb-3">
<label>
ایمیل
</label>
<input
class="form-control"
name="email"
value="{{ old('email',$user->email) }}">
</div>
<div class="col-md-6 mb-3">
<label>
موبایل
</label>
<input
class="form-control"
name="mobile"
value="{{ old('mobile',$user->mobile) }}">
</div>
</div>
<button class="btn btn-success">
ذخیره
</button>
</form>
<hr>
<h5>
تغییر رمز عبور
</h5>
<form method="POST"
action="{{ route('admin.users.ChangePassword',$user->id) }}">
@csrf
@method('PUT')
<input
type="password"
name="password"
class="form-control mb-2"
placeholder="رمز جدید">
<input
type="password"
name="password_confirmation"
class="form-control mb-2"
placeholder="تکرار رمز">
<button class="btn btn-primary">
تغییر رمز
</button>
</form>
</div>
</div>
</div>
@endsection
+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