New_Hides's avatar

Pagination Render() error

I'm wanting to use pagination but I'm getting this error when I run it:

ErrorException in Builder.php line 1992: Call to undefined method Illuminate\Database\Query\Builder::render() (View: C:\wamp\www\FrameWorks\Laravel_test_folder\property_test\resources\views\properties\list.blade.php)

Here is my controller:

$input = Request::all(); $properties = Property::whereBetween('NoofBedrooms', array($input['minbedroom'],$input['maxbedroom']))->whereBetween('price', array($input['minprice'],$input['maxprice']))->where('option', '=', 'sale')->paginate(3);

And my view:

    <div> @foreach ($properties as $properties)
    <div class="item">
    <div>
    <h2><a href ="{{ action('PropertyController@view', ($properties->id)) }}">{{ $properties->address }}</a></h2>
        @if (!Auth::guest())
            @if (Auth::user()->name == 'admin')
            <a href="{{ url('/properties/edit') }}">Edit</a>
            <a href="{{ url('/properties/delete') }}">Delete</a>
            @endif      
        @endif  
    </div>
        <div><label>City: </label>{{ $properties->City }}</div>
        <div><label>PostCode: </label>{{ $properties->Postcode }}</div>
        <div><label>Bedrooms: </label>{{ $properties->NoofBedrooms }}</div>
        <div><label>Price: </label>£{{ $properties->price }}</div>
        <div>{{ $properties->type }}</div>
    </div>@endforeach 

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

Any suggestions?

0 likes
4 replies
olimorris's avatar
Level 8

Hmmm...what about when you try

$properties as $property

it make's it more readable at the very least ;-)

2 likes
olimorris's avatar

@New_Hides - Great glad it worked! If you mark off the post with a 'best answer' tick then that will ensure the community can also benefit from this answer.

Please or to participate in this conversation.