priyasanka00's avatar

Method links does not exist.

Pagination is working properly for home view but its not working for category views same controller im using for categories and its separate by using routes, pl help me:

this is my controller:

$form1=new form1;

    $form1->name=$request->yourname;
    $form1->email=$request->email;
    $form1->tp=$request->tp;
    $form1->heading=$request->subject;
    $form1->text=$request->message;
    $form1->price=$request->price;
    $form1->nego=$request->exampleRadios;
    $form1->cate=$request->category;
    $form1->image=$filepath;
    $form1->image2=$filepath2;
    $form1->image3=$filepath3;
    $form1->save();
    
    
    //dd($form1);
    $dbreturn=form1::latest()->paginate(8);
    //dd($dbreturn);

    return redirect('home1')->with('form1',$dbreturn);

this is my home route and its working properly:

Route::get('/home1', function () { $data=App\form1::latest()->paginate(8); return view('home1')->with('form1',$data);

and this is my mobilephone category, its not woking error message is on title:

Route::get('/mobilephones', function () { $data=App\form1::latest()->where('cate', '=', '1')->paginate(8); return view('mobilephones')->with('form1',$data);

and this is my mobileptone blade file:

@foreach($form1 as $form)

                <div class="col-sm">
                    </br>
                    <div class="card" style="width: 18rem;">
                        <img src="{{ $form->image }}" class="card-img-top" alt="...">
                        <div class="card-body">
                            <h5 class="card-title">{{$form->heading}}</h5>
                            <p class="card-text">{{$form->text}}</p>
                            <b class="card-price">&#8360;{{number_format($form- 
                                                             >price,2)}}&nbsp;&nbsp;{{$form->nego}}</b><br>
                            <h class="time" class="card-text">{{$form->created_at->diffForHumans()}}
                                                            </h>
                            <a href="/viewformdata/{{$form->id}}" class="btn btn-primary"> See 
                                                         More</a>
                        </div>
                    </div>
                </div>
            @endforeach
            
            </div>  
        </div>
        </br>       
  </div>   
  
  <div class="container">
    
    <p5 class="pagi" style="font-size: 35px; ">{{ $form1->links() }}</p5>
0 likes
3 replies
jlrdw's avatar
return redirect('home1', compact ('dbreturn'));
{{ $dbreturn->links() }}
jlrdw's avatar

What's not working.

If you uncomment that dd does the data show.

Change that redirect to return view.

Please or to participate in this conversation.