Ejemplo n.º 1
0
 /**
  * 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);
     }
 }
Ejemplo n.º 2
0
 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));
     }
 }
Ejemplo n.º 3
0
 public function testAll()
 {
     $this->get('/api/memo/all')->assertResponseOk();
     $this->seeJsonEquals($this->memo->all()->toArray());
 }
Ejemplo n.º 4
0
 /**
  * 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'));
 }