private function queryAdvanced(array $queries = [])
 {
     $this->book->order($this->defaultOptions['orderBy'], $this->defaultOptions['order'])->page($this->defaultOptions['page'], $this->defaultOptions['limit']);
     $queriesList = ['q' => 'searchFor', 'title' => 'searchTitle', 'author' => 'searchAuthor', 'isbn' => 'searchIsbn', 'date' => 'searchDate', 'range' => 'searchDateRange', 'rate' => 'searchRate'];
     foreach ($queries as $key => $value) {
         if ($key === 'range') {
             list($from, $to) = $value;
             $this->book->{$queriesList[$key]}($from, $to);
         } else {
             $this->book->{$queriesList[$key]}($value);
         }
     }
     return $this->book->get()->toArray();
 }
Ejemplo n.º 2
0
 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function listBook()
 {
     return view('admin.partials.list_book', ['books' => Book::get()]);
 }