Esempio n. 1
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $books = Book::whereRaw('taken < curdate() - interval 30 day')->get();
     foreach ($books as $book) {
         $url = route('books');
         $user = User::find($book->user_id);
         $this->dispatch(new MailSender($user, $book, 'Did you forget to return a book to library?', 'emails.reminder', $url));
     }
 }
Esempio n. 2
0
 public function index()
 {
     //
     $kwords = Input::get('kword', '');
     $whereStr = "book_name like '%" . $kwords . "%'";
     $cou = \App\Book::whereRaw($whereStr)->count();
     $faqs = \App\Book::whereRaw($whereStr)->get();
     $myResult = array('cou' => $cou, 'faqs' => $faqs);
     //	echo $myResult;
     if ($cou == 0) {
         session()->flash('message_info', '没有查询到结果!');
     }
     return view('faq', ['faqs' => $myResult['faqs'], 'cou' => $myResult['cou'], 'kword' => '$kwords']);
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function getfind()
 {
     if (Input::has('q')) {
         $title = Input::get('q');
         $total = Book::whereRaw('title like "%' . $title . '%" or author like "%' . $title . '%"')->count();
         $listItem = Book::whereRaw('title like "%' . $title . '%" or author like "%' . $title . '%"')->paginate(ITEM_PER_PAGE);
         // $total = Book::whereRaw('title like "%'.$title.'%"')->count();
         // $listItem =  Book::whereRaw('title like "%'.$title.'%"')->paginate(4);
         return view('book.find', compact('listItem', 'total'));
     } else {
         redirect()->route('home');
     }
 }