/** * current - get current active AuthToken instance * @static * @return AuthToken|null */ public static function current() { $token = Request::header('X-Auth-Token', Input::get('X-Auth-Token')); if (static::$_current === null && $token) { static::$_current = static::where('token', $token)->where('expire_at', '>=', Carbon::now())->first(); } return static::$_current; }
public function notify() { if (!(Context::getKey()->isServer() && Request::header('X-Scheduled-Task'))) { throw new ForbiddenException("Need a 'device' key to perform this action."); } $notifier = new PushNotification\Notifier(); $messages = Model\App::collection('push_messages')->where('status', Model\PushMessage::STATUS_QUEUE); return $notifier->push_messages($messages); }