Search
 
SCRIPT & CODE EXAMPLE
 

PHP

user order by role spatie laravel

$values = Team::query()
      ->leftJoin('users', 'users.team_id', '=', 'teams.id')
      ->leftJoin('model_has_roles', function ($join) {
          $join->on('model_has_roles.model_id', '=', 'users.id')
               ->where('model_has_roles.model_type', '=', 'appModelsUser');
      })
      ->leftJoin('roles', 'roles.id', '=', 'model_has_roles.role_id')
      ->orderBy('roles.name')
      ->get();
Comment

PREVIOUS NEXT
Code Example
Php :: acf get all choices from select 
Php :: nginx php-fpm 
Php :: Laravel 8 Auth Scaffolding using Inertia Jetstream 
Php :: cut pice of text in laravel 
Php :: order by pre get posts 
Php :: yii2 activeform adding field css class 
Php :: pest check url status 
Php :: php md5 password is insecure 
Php :: laravel compare request domain and app domain and request original domain 
Php :: log magenot 1 
Php :: octobercms mail register 
Php :: single sign on php script 
Php :: Save image to custom meta box 
Php :: php configuration file location in centos 8 
Php :: xss=removed 
Php :: send mail infinityfree phpmailer 
Php :: Uninitialized string offset 
Php :: laravel form request validation api 
Php :: wordpress login programmatically 
Php :: laravel gmail send mail 2020 
Php :: laravel collection pop 
Php :: laravel zoom integration 
Php :: php sum array values by key 
Php :: upload image with watermark in codeigniter 
Php :: decode a nested JSON with php 
Php :: phpmail headers 
Php :: update to php 7.4 
Php :: if else in php 
Php :: laravel check if query builder is empty 
Php :: laravel best practices 
ADD CONTENT
Topic
Content
Source link
Name
7+8 =