3
votes

Question like this are asked, i have searched a lot but found nothing which works for me.

Here is Controller function:

public function showHomePage() {
    $communities = Community::all();
    $ideas = Idea::paginate(8);
    return view('publicPages.index', compact(['communities', 'ideas']));
}

Now the paginate method is working but when in view i call the method stated in documentation Docs

{!! $idea->render() !!}

It generates following error

Call to undefined method Illuminate\Database\Query\Builder::render()

I have also tried {!! $idea->render() !!} but the issue is same. Tried this also $ideas = DB::table('ideas')->paginate(8);

Here is view :

@foreach($ideas as $idea)
<div class="lst-popular-project clearfix">
  <div class="grid_3">
    <div class="project-short sml-thumb">
        <div class="top-project-info">
            <div class="content-info-short clearfix">
                <a href="{{URL::to('showidea', array($idea->id))}}" class="thumb-img">
                    <img src="{{asset($idea->idea_image)}}" alt="$TITLE">
                </a>
                <div class="wrap-short-detail">
                    <h3 class="rs acticle-title">
                        <a class="be-fc-orange" href="project">
                            {{$idea->idea_title}}
                        </a>
                    </h3>
                    <p class="rs tiny-desc">
                        by
                        <a href="profile.html" class="fw-b fc-gray be-fc-orange">
                            {{$idea->User->name}}
                        </a>
                    </p>
                    <p class="rs title-description">
                        {{$idea->idea_info}}
                    </p>
                    <p class="rs project-location">
                      <i class="icon iLocation"></i>
                      {{$idea->idea_location}}
                    </p>
                </div>
            </div>
        </div>
    </div>
</div>
@endforeach
2

2 Answers

4
votes

you must replace

{!! $idea->render() !!}

with
 {!! $ideas->render() !!}

$ideas variable contains from,total,page etc

1
votes

I guess it shoule be $ideas:

{!! $ideas->render() !!}