This commit is contained in:
victor 2020-07-29 13:33:11 +02:00
parent 6a4cdbfb17
commit 7da57d5e18
1 changed files with 21 additions and 6 deletions

View File

@ -10,6 +10,7 @@ use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Log;
use mysql_xdevapi\Table;
use Spatie\Permission\Models\Role;
@ -289,6 +290,14 @@ class UserController extends Controller
"</tr>";
//Join user and roles tables
//$users = User::query()->where('Roles', 'LIKE',$request->search.'%')->with(Spatie\Permission\Models\Role)->get();
//filter search
if($request->isCheck === "navn")
$users = User::query()->where('name_first', 'LIKE',$request->search.'%')->get();
@ -298,12 +307,18 @@ class UserController extends Controller
$users = User::query()->where('email', 'LIKE',$request->search.'%')->get();
elseif ($request->isCheck === "telefon")
$users = User::query()->where('phone', 'LIKE',$request->search.'%')->get();
elseif ($request->isCheck === "telefon")
$users = User::query()->where('phone', 'LIKE',$request->search.'%')->get();
elseif ($request->isCheck)
$users = User::query()->where('Roles', 'LIKE',$request->search.'%')->with(Role::class)->get();
else
$users = User::query()->where('name_first', 'LIKE',$request->search.'%')
$users = User::query()
->where('name_first', 'LIKE',$request->search.'%')
->orWhere('name_last','LIKE', $request->search.'%')
->orWhere('phone','LIKE', $request->search.'%')
->orWhere('email','LIKE',$request->search. '%')
->orWhere('name','LIKE',$request->search. '%')
->orWhere('roles','LIKE',$request->search. '%')
->get();