public function indexLoans() { $loans = \CrudHelper::index(new \App\Loan())->paginate(15); return view('loans.index')->with(['loans' => $loans]); }
public function getAllUsersWithRoles($model, $relations = []) { $users = \CrudHelper::index($model, $relations)->get(); return $users; }
/** * Unset users already able to view the contact * * @depends testGetAllUsers * @return Collection Collection of users able to view a contact */ public function testUnsetCanView($users) { $contact = CrudHelper::index(new App\CompanyContact(), ['canView'])->first(); $canViews = $contact->canView; $unsetCanViews = $this->contactsController->unsetCanView($canViews); foreach ($users as $user) { foreach ($canViews as $canView) { if ($user->id === $canView->id) { foreach ($unsetCanViews as $unsetCanView) { $this->assertTrue($unsetCanView->id !== $canView->id); } } } } }
/** * Unset categories that have been previously selected * * @depends testGetPeopleCategories * @return void */ public function testUnsetSelectedCategory($allCategories) { $people = \CrudHelper::index(new \App\PeopleContact(), ['category'])->first(); $selectedCategories = $people->category; // Provide $model, $selectedCategories $unsetSelectedCategories = $this->contactsController->unsetSelectedCategory(new \App\PeopleCategory(), $selectedCategories); foreach ($allCategories as $category) { foreach ($selectedCategories as $selectedCategory) { if ($category['id'] === $selectedCategory->id) { foreach ($unsetSelectedCategories as $unsetSelectedCategory) { $this->assertTrue($unsetSelectedCategory->id !== $selectedCategory->id); } } } } }