我有三个型号。
我有原始的SQL查询,我想转换成雄辩,但想不出办法。
SQL查询:
SELECT DISTINCT
b.message, c. phone_number, a.username, a.password from subscribed_services a
inner join
subscription_services_msisdn c on a.id = c.subscribed_services_id
inner join
scheduled_messages b on a.id = b.subscribed_services_id where DATE(b.scheduled_at) = CURDATE()
有人请帮助转换为雄辩。
关系
public function scheduled_messages()
{
return $this->hasMany(\App\Models\ScheduledMessage::class, 'subscribed_services_id');
}
public function subscription_services_msisdns()
{
return $this->hasMany(\App\Models\SubscriptionServicesMsisdn::class, 'subscribed_services_id');
}
谢谢。