Example #1
0
 /**
  * Load the roles for this user.
  *
  * @return void
  */
 protected function loadRoles()
 {
     if (!isset($this->cachedRoles)) {
         $this->cachedRoles = $this->model->roles()->get();
         $this->cachedRoleViews = clone $this->cachedRoles;
         $this->cachedRoleViews->transform(function ($role) {
             return new RoleViewModel($role);
         })->sort();
     }
 }
Example #2
0
 public function transformContacts(Collection $users)
 {
     return $users->transform(function ($user) {
         return $this->transformContact($user);
     });
 }
 public function transformMessages(Collection $messages, $redundantly = false)
 {
     return $messages->transform(function ($message) use($redundantly) {
         return $this->transformMessage($message, $redundantly);
     });
 }