/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $users = $this->userRepository->all(); $usersObject = []; if (is_array($users)) { /** * @var User $user */ foreach ($users as $user) { $usersObject[] = ['id' => $user->id, 'email' => $user->email, 'firstname' => $user->name->getFirstname(), 'lastname' => $user->name->getLastname()]; } } return $this->toJSONResponse(['users' => $usersObject]); }
public function compose($view) { $this->role->pushCriteria(new RoleOrderCriteria()); $view->roles = $this->role->all(); }
/** * Display list of users * * @return View */ public function index() { $users = $this->user->all(); return View::make('krustr::users.index', array('users' => $users)); }
/** @test **/ function it_fetches_all_the_rows_with_the_given_columns() { factory(User::class)->times(10)->create(); $repository = new UserRepository($this->newContainerMock(new User())); $user = $repository->all(['name'])->last(); $this->assertEquals(['name'], array_keys($user->toArray())); }
/** * Bind data to the view. * * @param View $view * @return void */ public function compose(View $view) { $view->with('categories_list', $this->categories->all()); }
/** * Bind data to the view. * * @param View $view * @return void */ public function compose(View $view) { $view->with('tags_list', $this->tags->all()); }