I am trying to get records of users from two tables..SALES TABLE & USER TABLE.
But from the SALES table, i want to get only sales of the current month for each of the user.
I have merged the tables already from the model, but when i try to get the record using this code it keeps pulling the sales for both current month and previous month from SALES table..
$myrecords = User::whereHas('sales', function($query) {
$query->whereMonth('sales.created_at', Carbon::now()->month);
}) ->get();
Please what am i doing wrong here
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3iH9ldF
via IFTTT
Aucun commentaire:
Enregistrer un commentaire