mercredi 1 juillet 2015

Laravel get rows with specific day and month

I have the following query in laravel:

$eventos = EventsData::join('tbl_users', 'tbl_users.id_user', '=', 'tbl_events.id_user')
            ->where('tbl_users.birth_date', '>=', date("m-d"))  //my error
            ->where('tbl_events.year', '>=', date("Y"))
            ->get();

I have a users table (tbl_users), with the date of the birthdays of each user. And an events table (tbl_events), which records the anniversary of each user. Thus creating a table that will get the next birthdays.

My birth_date is type "yyyy-mm-dd". The table events is the year. I want to get the next event on the current day and year.

ie I think the anniversary date must be greater than the current month and day, and the event with the top year to the current year

Aucun commentaire:

Enregistrer un commentaire