All code for reminders based on piggy banks. I hope.

This commit is contained in:
James Cole
2014-08-23 22:32:12 +02:00
parent d56c00915c
commit 6e17c805c2
28 changed files with 652 additions and 44 deletions

View File

@@ -302,4 +302,26 @@ class Toolkit implements ToolkitInterface
return $end;
}
/**
* @return mixed
*/
public function getReminders() {
// get reminders, for menu, mumble mumble:
$today = new Carbon;
$reminders = \Auth::user()->reminders()->validOn($today)->get();
/** @var \Reminder $reminder */
foreach($reminders as $index => $reminder) {
if(\Session::has('dismissal-' . $reminder->id)) {
$time = \Session::get('dismissal-' . $reminder->id);
if($time >= $today) {
unset($reminders[$index]);
}
}
}
\Session::put('reminderCount',count($reminders));
}
}

View File

@@ -23,4 +23,9 @@ interface ToolkitInterface
*/
public function getDateRangeDates();
/**
* @return mixed
*/
public function getReminders();
}