Example #1
0
 public function search()
 {
     $input = Input::all();
     if (isset($input['query'])) {
         $query = $input['query'];
         $data = Blog::select('title')->where('title', 'LIKE', '%' . $query . '%')->get()->toArray();
         return response()->json(["data" => $data]);
     }
 }
Example #2
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     return \View::make('home', ['title' => 'Home', 'favorites' => App\Product::orderBy('views', 'desc')->limit(9)->get(), 'posts' => App\Blog::select()->orderBy('id', 'desc')->limit(2)->get()]);
 }