hi everybode. I want to use group by according to the month of my created_at column, I've used cast property in my model like this: protected $casts = ["created_at" => "datetime:m"]; when I use dd() to check the output I don't see any changes in created_at attribute and it's still in carbon format, Is there anything wrong in my solution?
thank you all
@tisuchi
thanks for your reply, actually I just want to fetch data from database with eloquent, and then use groupBy Month of created_at, do you have any suggestion for that?
@Dragon_Worrior
thanks, actually I want to write a function for the part you wrote, because I want to use this group by in several collections, or, use casting in order to find month, and then just use groupBy function, is it possible?