Apr 5, 2020
0
Level 1
Awarding prizes to pilots for each flight date in Laravel
I have tree model : Pilot , Flight , Prize
Flight model contains :
pilot_id , flight_id , flight_date, prize_check=(defalt = 0)
Prize model contains :
pilot_id, flight_id, flight_date, prize_count
I want to give pilots a prize once a day. Even if they fly twice on the repetitive date, they will be awarded a prize.
Exceptions : If the pilots' flight dates are weekends, they will be awarded two prizes.
I want to check Flight model daily by Task Scheduling and save Prize model . and Update prize_check==1 after check completed
example :
-----------------------------------------------------------------------------
pilot_id ---- flight_id ---- flight_date ---- is_weekend --- prize_count
1 ---- 2 ---- 2020-04-01 ---- true --- 2
1 ---- 3 ---- 2020-04-01 ---- true --- 0
1 ---- 4 ---- 2020-04-02 ---- false --- 1
1 ---- 5 ---- 2020-04-02 ---- false --- 0
1 ---- 6 ---- 2020-04-03 ---- false --- 1
1 ---- 7 ---- 2020-04-03 ---- false --- 0
1 ---- 8 ---- 2020-04-03 ---- false --- 0
----------------------------------------------------------------------------
How can I write this?
Please or to participate in this conversation.