コード例 #1
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $keyword = Input::get('keyword');
     if (!$keyword) {
         $books = Books::orderBy('title', 'ASC')->get();
     } else {
         $books = Books::where('title', 'like', '%' . $keyword . '%')->orWhere('author', 'like', '%' . $keyword . '%')->get();
     }
     return view('catalog.index', compact('books'))->with('result', 'OK');
 }