samedi 8 octobre 2016

Laravel - FatalErrorException in usahaController.php line 33: Call to a member function paginate() on a non-object

I am making a search page in Laravel and cant understand how to use the paginate method for this usage.

I have used it else where, but not like this. usahaController

    public function feindex()
{
    $hasil= DB::select('sELECT anggota.USERNAME, kategori_usaha.NAMA_KATEGORI_USAHA, usaha.NAMA_USAHA, 
        usaha.TYPE_UMKM, usaha.GAMBAR_UMUM, usaha.ALAMAT_USAHA, usaha.NOMOR_TLPN_USAHA FROM usaha 
        JOIN anggota on usaha.ID_ANGGOTA=anggota.ID_ANGGOTA 
        JOIN kategori_usaha on usaha.ID_KATEGORI_USAHA=kategori_usaha.ID_KATEGORI_USAHA')->paginate(2);
    $keranjang['usaha']=$hasil;  
    return view('feindex', $keranjang);

}

view

            @foreach ($usaha as $item)
        <div class="col-sm-6 col-md-3">
            <div class="thumbnail text-center">

                <a href="single_product.html"><img src="" class="img-responsive"></a>
                <br/>
                <h5 class="text-primary"></h5>
                <ul>
                    <li><i class="livicon" data-name="check" data-size="18" 
                    data-loop="true" data-c="#787878" data-hc="787878"></i> Nama Pengusaha :<br>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</li>
                    <li><i class="livicon" data-name="check" data-size="18" 
                    data-loop="true" data-c="#787878" data-hc="787878"></i> </li>
                    <li><i class="livicon" data-name="check" data-size="18" 
                    data-loop="true" data-c="#787878" data-hc="787878"></i>  </li>
                    <li><i class="livicon" data-name="check" data-size="18" 
                    data-loop="true" data-c="#787878" data-hc="787878"></i> </li>
                    <li><i class="livicon" data-name="check" data-size="18" 
                    data-loop="true" data-c="#787878" data-hc="787878"></i>  </li>
                </ul>
                <a href="single_product.html" class="btn btn-primary btn-block text-white">View</a>
            </div>
        </div>
        @endforeach
        {!! $usaha->render() !!}

how fix this



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire