samedi 6 février 2021

Fetch records that matches month and year using Laravel eloquent

How do I query a table such that it only fetches records that matches a particular month and year e.g. Y-m i.e. 2020-10. of the 'created_at' column.

This is what I am currently doing:

School::where('user_id', 1)->where('created_at', '=', '2020-10')->count();


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire