當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Book::whereRaw方法代碼示例

本文整理匯總了PHP中app\Book::whereRaw方法的典型用法代碼示例。如果您正苦於以下問題:PHP Book::whereRaw方法的具體用法?PHP Book::whereRaw怎麽用?PHP Book::whereRaw使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\Book的用法示例。


在下文中一共展示了Book::whereRaw方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: handle

 /**
  * 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));
     }
 }
開發者ID:VasylKozyrenko,項目名稱:library,代碼行數:14,代碼來源:Remind.php

示例2: index

 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']);
 }
開發者ID:kevin20x2,項目名稱:fucklaravel,代碼行數:14,代碼來源:FaqController.php

示例3: getfind

 /**
  * 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');
     }
 }
開發者ID:hoangtrungweb,項目名稱:cungdocsach,代碼行數:19,代碼來源:BookController.php


注:本文中的app\Book::whereRaw方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。