Elysion Kısa yolu yok ama Collection macro yapılarak halledilebilir.
App\Providers\AppServiceProvider::boot() yöntemi içerisine şunu ekleyin:
use Illuminate\Support\Collection;
use Illuminate\Pagination\LengthAwarePaginator;
Collection::macro('paginate', function(int $perPage = 15, string $pageName = 'page', int $page = null, int $total = null, array $options = []) {
$page = $page ?: LengthAwarePaginator::resolveCurrentPage($pageName);
$results = $this->forPage($page, $perPage)->values();
$total = $total ?: $this->count();
$options += [
'path' => LengthAwarePaginator::resolveCurrentPath(),
'pageName' => $pageName,
];
return new LengthAwarePaginator($results, $total, $perPage, $page, $options);
});
Bunu kullanabilmek için diziyi Collection objesine çevirmeniz lazım. Şu şekilde yapabilirsiniz:
$data = collect($displayDataArray)->paginate(10);
Not: Umarım gerçekten inbox_table şeklinde bir model adı kullanmıyorsunuzdur...