Laravel – sort collection, JSON returns object

Sorting is very common operation in many languages and a lot of data. Of course the best way is to sort on database, because it’s created for such operations, but sometimes I work with smaller parts of data and do that on API server side. Since when I’ve used Laravel, I often use Collections instead of arrays – they methods are very clean, simple and offer a lot of possibilities. I also often sort collections before outputting them as, for example JSON – natural sorting is more than useful in so many cases. But there is one important thing: if you have associative array (or collection) and use sorting, you client will not receive valid array, but object. This short post will show you, how to deal with it.

Continue reading “Laravel – sort collection, JSON returns object”

Pandemic advantages

Pandemic

May you live in interesting times – says the old Chinese curse for our enemies. We definitely had to live in such times, because hardly anyone expected, that the COVID pandemic would change our daily lives so much, it would affect, it would seem, completely peaceful functioning. However, nothing lasts forever, and changes are not so much something to defend against, but something to wait and prepare for: sometimes worse, sometimes better, but changes. Was that current situation only bad? Definitely not. In my opinion, the COVID pandemic has a lot of advantages, and a few of them would like to share with you in this post.

Continue reading “Pandemic advantages”

Why I like running?

Running

People who know me, know very well that I like cycling. It started a good few years ago and continues to this day. However, one must admit openly that this love has evolved all the time and has changed dramatically. I started with small trips around my hometown, and during the peak period, I went on a full-day trip of over 300 km. For a long time, the bike is not my only hobby. It is also running, which I take more and more time and I want to take more time in the future. Where does it come from and why I liked running so much? This post is about it.

Continue reading “Why I like running?”

Elite Suito trainer review

Elite Suito Review

I’ve used bike trainer for few years and think, that is great idea, especially in winter. I really don’t like riding in cold, wear a lot of clothes, using lights etc. With trainer, I could just make good training: with many apps for that, in good conditions and without any dangerous like too fast cars on roads. I don’t use trainer now and don’t plan to use it anymore but will write about that on next post. This one is about Elite Suite – my latest, very nice trainer. It’s just quick review, I’m not professional, but probably it can help someone choose good stuff to train in home.

Continue reading “Elite Suito trainer review”

Continental Terra Speed 700x35c review

Continental Terra Speed #1

Compared to two, three years ago, we have a lot of good tires for gravel in the market now. The problem is choice: we don’t know, what should we choice. Are newer tires better than older, like reviewed Gravelkings SK? There is only one way to check it: buy, ride and test. I’m still looking for best tires for my usage: a lot of tarmac, but often very bad quality, some gravel, preferably dry conditions because I don’t like mess. Last time I decided to try something other than Gravelkings AC/Mud, something probably faster. After reading a lot of reviews, a lot of comments, chose Continental Terra Speed in size 700x35c.

Continue reading “Continental Terra Speed 700x35c review”