Recent Posts



Tips and Tricks

How to use Laravel whereBetween properly?

I realized that using whereBetween is not that easy. Personally I have faced problem to use that. Here is the final thought that I can come out- $month = 01; $year = 2018; return User::whereBetween('created_at', [$year . "-" . $month . "-01 00:00:00", $year . "-" . $month . "-" . cal_days_in_month(CAL_GREGORIAN, $month, $year) . " [...]


How to convert number to month name in PHP

Here is the code that how can you convert number to month name in PHP. Think of it, you have a month number 01, 02, … that is equivalent to January, February, … $monthNum = 3; $dateObj = DateTime::createFromFormat('!m', $monthNum); $monthName = $dateObj->format('F'); // March Alternative way, you can try this- $monthNum = [...]


How to query as GROUP BY in django?

If you are facing how to write query as Group By in django, this post might be helpful for you. Imagine that, you want to write query like this way. SELECT userid, COUNT(userid) AS ucount FROM members GROUP BY userid Now, in your view’s function, add- //import library from django to count record from django.db.models import Count [...]