/** * memo/all API. * * @Any("all", as="api.memo.all") * * @return \Illuminate\Http\JsonResponse */ public function anyAll() { try { $memos = $this->memo->all(); return $this->onSuccess($memos); } catch (Exception $e) { return $this->onError($e); } }
public function testIndex() { $memos = $this->memo->orderBy('id', 'desc')->paginate(10); $count = $this->memo->all()->count(); $this->visit('/memo')->see("合計{$count}件のメモ")->seeInfo()->assertResponseOk(); foreach ($memos as $memo) { $this->see($memo->id)->see($memo->created_at->format(dateFormat()))->see($memo->user_sn)->see("/memo/user/{$memo->user_sn}")->see(autoLink($memo->content)); } }
public function testAll() { $this->get('/api/memo/all')->assertResponseOk(); $this->seeJsonEquals($this->memo->all()->toArray()); }
/** * Index page (get). * * @Get("/", as="memo.index") * * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function getIndex() { $memos = $this->memo->orderBy('id', 'desc')->paginate(10); $count = $this->memo->all()->count(); return view('memos.index', compact('memos', 'count')); }