mercredi 8 juillet 2020

Crashes when using Union and Pagination

$medias = DB::connection('oracle').....
                   
$materials = DB::connection('oracle').....
                     
$union = $materials->union($medias);

 //pagination    
$page = Request::get('page', 1);
$paginate = 50;

$offSet = ($page * $paginate) - $paginate;
$itemsForCurrentPage = array_slice($union, $offSet, $paginate, true);
$union = new \Illuminate\Pagination\LengthAwarePaginator($itemsForCurrentPage, count($union), $paginate, $page);

return view('ReceiveMedia.index', compact('union'));

When running it I get an error like this

Error :

ErrorException (E_WARNING) array_slice() expects parameter 1 to be array, object given

I searched the solution, I get like this

$union = $materials->union($medias)->get()->toArray();

But, it keeps me getting an error

Symfony \ Component \ Debug \ Exception \ FatalErrorException (E_UNKNOWN) Maximum execution time of 60 seconds exceeded

I'm so frustrated about this. Please if you know a solution would be to tell me



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire