Ich mache CRUD und möchte Daten mit Paginierung.So bisher habe ich Daten von MySQL abgerufen, aber wenn ich auf die nächste Schaltfläche geklickt die Route nicht funktioniert.Vielen Dank im Voraus für die Hilfe. im Folgenden werde ich meinen Code bin Hochladen:Laravel Paginierung render() -Methode funktioniert nicht richtig
Hier ist mein Controller Index-Methode
public function index()
{
$alldat=DB::select("SELECT a.id as id,a.`name`as name,b.name as catName,(case when a.status=1 then 'Available' else 'out of stock' end) as status FROM `subcategories` a,`categories` b where a.cat_id=b.id");
$query="SELECT a.id as id,a.`name`as name,b.name as catName,(case when a.status=1 then 'Available' else 'out of stock' end) as status FROM `subcategories` a,`categories` b where a.cat_id=b.id";
$alldata = new Paginator($alldat, 5, 1);
return view('admin_theme.dynamic_files.subcategory.allSubCategory',compact('alldata'));
}
Hier ist meine Ansicht Blade-Datei:
<div class="form-body">
<table class="table">
<thead>
<tr>
<th>Id</th>
<th>SubCategory Name</th>
<th>ParrentCategory Name</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody>
@foreach($alldata as $data)
<tr class="success">
<td>{{$data->id}}</td>
<td>{{$data->name}}</td>
<td>{{$data->catName}}</td>
<td>{{$data->status}}</td>
<td><a href="{{route('subcategory.edit',$data->id)}}" class="btn btn-info" role="button">Edit</a>
<a href="" class="btn btn-danger" role="button">Delete</a>
</td>
</tr>
@endforeach
</tbody>
</table>
{!!$alldata-> render()!!}
</div>
Bitte, Hilfe anyone.Thanks in ad Vance
, was Sie bekommen, wenn dd ($ alldata) ..? –
nach give dd: Paginator {# 207 ▼ #hasMore: true #items: Sammlung {# 221 ▼ #items: array: 5 [▼ 0 => {# 208} ▶ 1 => {# 210 ▶ } 2 => {# 211} ▶ 3 => {# 212} ▶ 4 => {# 213} ▶ ] } #perPage: 5 #currentPage: 1 #PATH: "/" #query: [] #fragment: null #pageName: "page" } –
hier ist der Pfad "/", ich denke es sollte resolve.any Idee sein? –