本文整理汇总了PHP中Entry::confirmed方法的典型用法代码示例。如果您正苦于以下问题:PHP Entry::confirmed方法的具体用法?PHP Entry::confirmed怎么用?PHP Entry::confirmed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entry
的用法示例。
在下文中一共展示了Entry::confirmed方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: score
/**
* Recalculates the scores for the competition entries and (optionally) sends
* a notification email to the contestants.
*/
public function score()
{
$msg = "Updated the scores for the competition entries";
$entries = Entry::confirmed()->get();
foreach ($entries as $entry) {
$entry->calculateScore();
}
if (Input::has('send_notifications')) {
$send_notifications = Input::get('send_notifications');
if ($send_notifications) {
$entries->sortByDesc('score');
$top_three = $entries->take(3);
$contestants = $entries->lists('email');
Mail::send('emails.score', array('entries' => $top_three), function ($message) use($contestants) {
$message->to($contestants)->subject('RWC 2015 Competition');
});
$msg = "Updated the scores for the competition entries and sent emails to the contestants.";
}
}
return Redirect::route('admin.index')->withInfo($msg);
}
示例2: index
public function index()
{
$entries = Entry::confirmed()->orderBy('score', 'desc')->orderBy('first_name')->orderBy('last_name')->get();
return View::make('home')->with('entries', $entries);
}