/**
  * Display a listing of the resource.
  *
  * @return data[
  *      name => string
  *      desc => string
  *      link => string
  *      image => string
  *      number => string
  *      is_read => boolean
  *      update_at => string
  * ]
  *  order by update_at
  */
 public function index()
 {
     $data = [];
     $books = \App\Books::orderBy('updated_at', 'desc')->get();
     foreach ($books as $book) {
         $row = [];
         $comic = $book->comics;
         $row['bookId'] = $book->id;
         $row['name'] = $comic->name;
         $row['desc'] = $comic->desc;
         $row['imagePath'] = $comic->imagePath;
         $row['bookLink'] = "http://8yyls.com/" . $comic->onlineId;
         $row['number'] = $book->chapter;
         $row['is_read'] = $book->is_read;
         $row['link'] = $book->link;
         $row['update_at'] = $book->updated_at->toDateTimeString();
         array_push($data, $row);
     }
     return view('index')->with('data', $data);
 }
Esempio n. 2
0
 public function index()
 {
     $categories = Category::all();
     $books = Books::orderBy('id', 'desc')->paginate(16);
     return view('books.index', compact('books', 'categories'));
 }
 public function index()
 {
     $books = Books::orderBy('id', 'desc')->paginate(16);
     return view('admin.books.index', compact('books'));
 }