Witam, chciałbym aby email wysyłał wszystkie opcje, które spełniają warunek. Teraz wysyła każdą opcję osobno.
oto kod:
public function action_expiring()
{
$announcements = ORM::factory('Announcement')
->with('user')
->where(Db::expr('DATEDIFF(announcement.annoucement_availability, NOW())'), '=', 7)
->find_all();
$i = 0;
foreach ($announcements as $a)
{
$email = Model_Email::email_by_alias('annoucements_expiring_registered');
$renew_url = Route
::url('site_announcements/profile/announcements/renew', array( 'id' => $a->annoucement_id,
), 'http');
'%renew_url%' => $renew_url,
'%renew_link%' => HTML::anchor(
$renew_url,
___('announcements.expiring.registered.renew_btn')
),
'%annoucement_link%' => HTML::anchor(announcements::url($a, 'http'), $a->annoucement_title),
));
$email->send($a->user->user_email);
}
$i++;
}
Nie mam pomysłu jak do tego podejść.