Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel search user details by specific role

$search_query = $request->search_query;
$role = 'Member';
$results = User::with('roles')->whereHas("roles", function($q) use($role){ 
            $q->where('title', '=', $role);
        })->where('name', 'LIKE', "%{$search_query}%")->paginate(4);
Comment

PREVIOUS NEXT
Code Example
Php :: Laravel eloquent get data without duplicates 
Php :: wp tax_query in 
Php :: get post data in laravel 
Php :: php implode array 
Php :: get id by url wordpress 
Php :: genrate file name in php 
Php :: get user role in symfony 
Php :: laravel create db 
Php :: php session name 
Php :: how to create an associative array in php 
Php :: Automatically Delete Woocommerce Images After Deleting a Product 
Php :: Unable to create PsySH runtime directory. Make sure PHP is able to write to /run/user in order to continue. 
Php :: web scraping in php 
Php :: phpspreadsheet set cell by column and row 
Php :: open json file php 
Php :: use multiple pagination in same page laravel 
Php :: Laravel Excel numbers formatted as text still appearing as number 
Php :: redirect to attempting url after login laravel 
Php :: php group multidimensional array by value 
Php :: laravel add attribute to model 
Php :: emergency password reset script wordpress 
Php :: php get all in object as array 
Php :: laravel validation digits 
Php :: laravel raw query join many to many 
Php :: string array to array in php 
Php :: laravel eloquent select case when 
Php :: php get day of week 
Php :: laravel loop iteration 
Php :: count an array in php 
Php :: sorting sql query array by column key php 
ADD CONTENT
Topic
Content
Source link
Name
8+9 =