app/Http/Controllers/MahasiswaController.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)
    {
        $mahasiswas = Mahasiswa::all(); 
        $posts = Mahasiswa::when($request->keyword, function ($query) use ($request){
            $query->where('Nama', 'LIKE', "%{$request->keyword}%");
        })->paginate(5);
        return view('mahasiswas.index', compact('mahasiswas','posts'));
    }
public function index ( Request $ request ) { $ mahasiswas = Mahasiswa :: all ( ) ; $ posts = Mahasiswa :: when ( $ request -> keyword , function ( $ query ) use ( $ request ) { $ query -> where ( 'Nama' , 'LIKE' , " % { $ request -> keyword } % " ) ; } ) -> paginate ( 5 ) ; return view ( 'mahasiswas.index' , compact ( 'mahasiswas' , 'posts' ) ) ; }
Display a listing of the resource.
Display a listing of the resource .
//fungsi eloquent menampilkan data menggunakan pagination // Mengambil semua isi tabel