Beispiel #1
0
 public static function display($org, $type, $id = null)
 {
     $fields = self::fields();
     if ($id) {
         $user = \User::first(['_id' => $id, 'org_id' => $org->_id, 'type' => $type]);
         $users = \User::objectArr($user, $fields);
         $data = ["{$type}" => (array) $users[0]];
     } else {
         $users = \User::all(['org_id' => $org->_id, 'type' => $type]);
         $data = ["{$type}s" => \User::objectArr($users, $fields)];
     }
     return $data;
 }