laravel 5.4 - How to return users who has a certain role in a select field -


i have role called 'center admin' using permissionmanager. want return users has role.

at moment have followings , returns users. can add $user->hasrole('center admin'), select field shows center admin?

thanks.

in app/user.php

/** * center record associated user. */ public function center() { return $this->hasone('app\model\center'); }

in app/models/center.php

/** * user of center. */ public function user() { return $this->belongsto('app\user'); }

in app/controller/admin/centercontroller.php

$this->crud->addfield([ 'name' => 'user_id', 'label' => 'user', 'type'=>'select', 'tab' => 'general', 'entity' => 'user', 'attribute' => 'name', 'model'=>'app\user', ]);


Comments