look I got this so far
$infomation = '[{ "name": "Necklace", "created_at": "2019-03-01" }, { "name": "Bracelet", "created_at": "2019-03-05" }, { "name": "Dog Chain", "created_at": "2020-05-27" }]';
$array = json_decode($infomation, true);
$collection = collect($array);
output
Illuminate\Support\Collection {#2360
all: [
[
"name" => "Necklace",
"created_at" => "2019-03-01",
],
[
"name" => "Bracelet",
"created_at" => "2019-03-05",
],
[
"name" => "Dog Chain",
"created_at" => "2020-05-27",
],
],
}
I want just the create_at of march, in this case is 03 the month so I need to get in the collection just necklace and bracelet not dog chain how-to?
so I try to use this but got an error
$collection->whereMonth('created_at', '=', '03')
->get();
BadMethodCallException with message 'Method Illuminate\Support\Collection::whereMonth does not exist.'