Laravel 5: Manual Pagination From Array.


Laravel documents is not covering anything about making a pagination from your custom array. its very nice and easy to use pagination out of the box with eloquent queries, but if you want to know how to do it with your custom arrays then you might find it hard searching around in their website.

Anyway here is the easy and workable way of making a pagination out of your custom data array.

Continue reading Laravel 5: Manual Pagination From Array.

Detect MIME type and buffer it to browser using PHP

The following piece of code handles detection of mime type, file size and existence of the file for you. I always use this piece for buffering files into browser of my users.

All you have to do is to change the variable of $filelocation with your own variable which contains the full address of your local file.

Hope it helps some of you out there.

Keep Get Variables with Laravel 5 Pagination in Blade

Using pagination in Laravel views using blade will automatically add the pages get request to the page whenever you click on a page number. by default this will cause all other get requests of the page to be removed and replaced by ?pages.

To overcome this you should use the pagination in your blade template like below:

Of course you need to change $yourlist to your variable name which contains the array you wish to paginate.

Delay in JavaScript Loop

setTimeout is not the answer when it comes to delay in loops in Javascript. Using setTimeout will cause the first cycle to have the delay and then it will run to the end of the loop from the second time.

The above piece of code is the best solution that I mostly use in my apps for causing delays in Javascript Codes.