Make name and e-mail based searches with like for easier administration. (#1397)

* Update UserRepository.php

Make `name` and `e-mail` based searches with `like` for easier administration and search.

* Update search.blade.php

Remove old dashed out code

* Update index.blade.php

Add proper state selections
This commit is contained in:
B.Fatih KOZ 2022-02-08 00:02:17 +03:00 committed by GitHub
parent 94735103aa
commit 08624042f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 13 deletions

View File

@ -90,11 +90,11 @@ class UserRepository extends Repository
}
if ($request->filled('name')) {
$where['name'] = $request->name;
$where[] = ['name', 'LIKE', '%'.$request->name.'%'];
}
if ($request->filled('email')) {
$where['email'] = $request->email;
$where[] = ['email', 'LIKE', '%'.$request->email.'%'];
}
if ($request->filled('state')) {

View File

@ -2,12 +2,26 @@
@section('title', 'Users')
@section('actions')
<li><a href="{{ route('admin.userfields.index') }}">
<i class="ti-user"></i>Profile Fields</a>
<li>
<a href="{{ route('admin.userfields.index') }}"></i>Profile Fields</a>
</li>
<li><a href="{{ route('admin.users.index') }}?search=state:0">
<i class="ti-user"></i>@lang(UserState::label(UserState::PENDING))</a>
<li>
<a href="{{ route('admin.users.index') }}?state=0">@lang(UserState::label(UserState::PENDING))</a>
</li>
<li>
<a href="{{ route('admin.users.index') }}?state=1">@lang(UserState::label(UserState::ACTIVE))</a>
</li>
<li>
<a href="{{ route('admin.users.index') }}?state=2">@lang(UserState::label(UserState::REJECTED))</a>
</li>
<li>
<a href="{{ route('admin.users.index') }}?state=3">@lang(UserState::label(UserState::ON_LEAVE))</a>
</li>
<li>
<a href="{{ route('admin.users.index') }}?state=4">@lang(UserState::label(UserState::SUSPENDED))</a>
</li>
<li>
<a href="{{ route('admin.users.index') }}?state=5">@lang(UserState::label(UserState::DELETED))</a>
</li>
@endsection

View File

@ -10,12 +10,6 @@
{{ Form::label('email', 'Email:') }}
{{ Form::text('email', null, ['class' => 'form-control']) }}
&nbsp;
{{--{{ Form::label('dep_icao', 'Departure:') }}
{{ Form::select('dep_icao', $airports, null , ['class' => 'form-control']) }}
&nbsp;
{{ Form::label('arr_icao', 'Arrival:') }}
{{ Form::select('arr_icao', $airports, null , ['class' => 'form-control']) }}
&nbsp;--}}
{{ Form::submit('find', ['class' => 'btn btn-primary']) }}
&nbsp;
<a href="{{ route('admin.users.index') }}">clear</a>