本文整理汇总了PHP中app\News::getForDelivery方法的典型用法代码示例。如果您正苦于以下问题:PHP News::getForDelivery方法的具体用法?PHP News::getForDelivery怎么用?PHP News::getForDelivery使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\News
的用法示例。
在下文中一共展示了News::getForDelivery方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index($token)
{
if ($token === 'W2Xcoiq28sLNasiszA819qgLk42CTc5b') {
$addressees = Model::all();
$news = News::getForDelivery();
$tenders = Tender::getForDelivery();
$vacancies = Vacancy::getForDelivery();
$shares = Share::getForDelivery();
$expert_advices = ExpertAdvice::getForDelivery();
foreach ($addressees as $addressee) {
$params['title'] = $addressee->locale . '_title';
$params['text'] = $addressee->locale . '_text';
$params['locale'] = $addressee->locale;
$addressee->news && count($news) ? $params['delivery']['news'] = $news : null;
$addressee->tenders && count($tenders) ? $params['delivery']['tenders'] = $tenders : null;
$addressee->vacancies && count($vacancies) ? $params['delivery']['vacancies'] = $vacancies : null;
$addressee->shares && count($shares) ? $params['delivery']['shares'] = $shares : null;
$addressee->expert_advices && count($expert_advices) ? $params['delivery']['expert_advices'] = $expert_advices : null;
if (isset($params['delivery'])) {
Mail::send('emails.delivery', $params, function ($message) use($addressee) {
$from_address = MailConfig::first();
$from_name = Config::get('mail.from');
$message->from($from_address->feedback_mail, $from_name['name']);
$message->to($addressee->email)->subject(trans('front-end' . DS . 'emails' . DS . 'delivery.subject'));
});
}
unset($params);
}
News::where('sended', 0)->update(['sended' => 1]);
Tender::where('sended', 0)->update(['sended' => 1]);
Vacancy::where('sended', 0)->update(['sended' => 1]);
Share::where('sended', 0)->update(['sended' => 1]);
ExpertAdvice::where('sended', 0)->update(['sended' => 1]);
}
}