Hi everyone, i have done the pagination coding, but the view couldn't call out, can someone guide me ? My (categoryController.php) :
// $tmp = Category::all()->toArray();
$tmp = Category::where('code','like','%' .$codeSearch. '%')->where('description','like','%' .$codeSearch. '%')->paginate(5);
$category = array();
foreach ($tmp as $key => $row) {
$policy = Category::find($row['parent_id']);
$tmpResult = new Category();
$tmpResult->id = $row['id'];
$tmpResult->code = $row['code'];
$tmpResult->description = $row['description'];
$tmpResult->parent_id = $policy['description'];
$tmpResult->status = $row['status'];
array_push($category, $tmpResult);
}
return view('category.index', compact('category'));
}
My index.blade.php :
@foreach($category as $row)
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td><a href="" class="btn btn-warning">Edit</a></td>
<td>
<form method="post" class="delete_form" action="">
<input type="hidden" name="_method" value="DELETE" />
<button type="submit" class="btn btn-danger">Delete</button>
</form>
</td>
</tr>
@endforeach
</table>
<div class="container">
@foreach ($category as $row)
@endforeach
</div>
{!! $category->render() !!}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire