Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT
- year(created_at) as year,
- monthname(created_at) as month, //// month=1 // monthname=january, february
- count(*) published
- FROM posts
- GROUP BY year, month
- on laravel
- ==
- App\Post::selectRaw('year(created_at) as year, monthname(created_at) as month')->groupBy('year', 'month')->get();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement