app/Http/Controllers/CekKendaraanController.php
/**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
Display a listing of the resource.
@return \Illuminate\Http\Response
Display a listing of the resource . @return \ Illuminate \ Http \ Response
public function index(Request $request)
    {
        $keyword = $request->get('keyword');
        $kendaraan = cekkendaraan::all();
        if($keyword){
            $kendaraan = cekkendaraan::where("merk","LIKE", "%$keyword%")->get();
            $posts = cekkendaraan::orderBy('id_kendaraan', 'desc')->paginate(3); 
        }
        $posts = cekkendaraan::orderBy('id_kendaraan', 'desc')->paginate(3); 
        return view('CekKendaraan.index', compact('kendaraan','posts','keyword'));
    }
public function index ( Request $ request ) { $ keyword = $ request -> get ( 'keyword' ) ; $ kendaraan = cekkendaraan :: all ( ) ; if ( $ keyword ) { $ kendaraan = cekkendaraan :: where ( " merk " , " LIKE " , " % $ keyword % " ) -> get ( ) ; $ posts = cekkendaraan :: orderBy ( 'id_kendaraan' , 'desc' ) -> paginate ( 3 ) ; } $ posts = cekkendaraan :: orderBy ( 'id_kendaraan' , 'desc' ) -> paginate ( 3 ) ; return view ( 'CekKendaraan.index' , compact ( 'kendaraan' , 'posts' , 'keyword' ) ) ; }
Display a listing of the resource.
Display a listing of the resource .