Example #1
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));
     }
 }
Example #2
0
 /**
  * Create sitemap data.
  *
  * @return array
  */
 protected function createSiteMapData()
 {
     $data = [];
     $pasteBin = new M\PasteBin();
     $last = $pasteBin->orderBy('id')->get()->last();
     $data[] = ['loc' => '/pastebin', 'lastmod' => $last->created_at->format('Y-m-d'), 'changefreq' => 'monthly', 'priority' => '0.7'];
     $all = $pasteBin->select(['hash', 'created_at'])->where('protect', '=', false)->get();
     foreach ($all as $p) {
         $data[] = ['loc' => "/pastebin/show/{$p->hash}", 'lastmod' => $p->created_at->format('Y-m-d'), 'changefreq' => 'never', 'priority' => '0.4'];
     }
     $memo = new M\Memo();
     $last = $memo->orderBy('id')->get()->last();
     $data[] = ['loc' => '/memo', 'lastmod' => $last->created_at->format('Y-m-d'), 'changefreq' => 'monthly', 'priority' => '0.7'];
     foreach ($memo->select(['id', 'created_at'])->get() as $m) {
         $data[] = ['loc' => "/memo/show/{$m->id}", 'lastmod' => $m->created_at->format('Y-m-d'), 'changefreq' => 'never', 'priority' => '0.4'];
     }
     foreach ($memo->select('user_sn')->distinct()->get() as $m) {
         $updated_at = $memo->where('user_sn', '=', $m->user_sn)->get()->last()->updated_at;
         $data[] = ['loc' => "/memo/user/{$m->user_sn}", 'lastmod' => $updated_at->format('Y-m-d'), 'changefreq' => 'monthly', 'priority' => '0.4'];
     }
     return $data;
 }
Example #3
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'));
 }