/** * Display a listing of the resource. * * @return Response */ public function index(Request $request) { if ($request->has('q')) { $needle = trim($request->input('q')); return view('index', ['videos' => Video::withAllTags($needle)->paginate(20)->appends(['q' => $needle]), 'categories' => Category::all(), 'q' => $needle]); // $pdo = \DB::connection()->getPdo(); // $needle = '%' . trim($request->input('q')) .'%'; // `songindex` will need to be changed due to the view name being changed to index. // return view('songindex', [ // 'videos' => Video::where(function($query) use($needle) { // $query->where('interpret', 'LIKE', $needle) // ->orWhere('songtitle', 'LIKE', $needle) // ->orWhere('imgsource', 'LIKE', $needle); // }) // //->orderBy('id', 'ASC') // ->orderByRaw("((interpret like " . $pdo->quote($needle) . ") + // (songtitle like " . $pdo->quote($needle) . ") + // (imgsource like " . $pdo->quote($needle) . ")) desc") // ->paginate(20)->appends(['q' => trim($needle, '%')]), // 'categories' => Category::all() // ]); } return view('index', ['videos' => Video::orderBy('id', 'ASC')->paginate(20), 'categories' => Category::all()]); }
/** * Display a listing of the resource. * * @return Response */ public function admin() { $videos = Video::orderBy('created_at', 'DESC')->get(); return view('videos.backend.index', compact('videos')); }
/** * Display a listing of the resource. * * @return Response */ public function index() { return view('songindex', ['videos' => Video::orderBy('id', 'ASC')->paginate(20)]); }