예제 #1
0
 /**
  * PHP shutdown handler that notifies Airbrake about shutdown. Should be
  * used with register_shutdown_function.
  */
 public function onShutdown()
 {
     $error = error_get_last();
     if ($error === null) {
         return;
     }
     if ($error['type'] & error_reporting() === 0) {
         return;
     }
     $exc = new Errors\Fatal($error['message'], debug_backtrace());
     $this->notifier->notify($exc);
 }
예제 #2
0
 /**
  * @see Notifier::notify()
  * @param string $eventName
  * @param array $params
  * @return bool
  */
 protected function notify($eventName, array $params = array())
 {
     return $this->eventNotifier->notify($eventName, $params);
 }
예제 #3
0
 /**
  * 
  * @param   string $message The message to print.
  * @param   string $page    (optional) A specific admin page in which the
  *                          notification should appear. If no page is specified
  *                          the message will be visible in all admin pages.
  */
 static function success($message, $page = null)
 {
     Notifier::notify($message, Notifier::SUCCESS, $page);
 }
예제 #4
0
 public function __call($method, $args)
 {
     $event = $this->notifier->notify('call', array('method' => $method, 'args' => $args));
     return call_user_func_array(array($this->object, $method), $event->getReturnValue($args));
 }
예제 #5
0
 /**
  * Alias for Notifier::notify.
  */
 public static function notify($exc)
 {
     return self::$notifier->notify($exc);
 }
예제 #6
0
<?php

use Carbon\Carbon;
use Illuminate\Support\Facades\Auth;
Route::group(["prefix" => 'notifications'], function () {
    Route::get('/', 'ffy\\notifications\\Http\\Controllers\\NotificationController@index');
    Route::get('follow/{id}', 'ffy\\notifications\\Http\\Controllers\\NotificationController@follow');
    Route::get('see/{id}', 'ffy\\notifications\\Http\\Controllers\\NotificationController@see');
    Route::get('unsee/{id}', 'ffy\\notifications\\Http\\Controllers\\NotificationController@unsee');
    // this is an example, please delete
    Route::get('create', function () {
        echo 'creating notification';
        foreach (range(10, 50) as $item) {
            $data = ['name' => 'Nikos', 'val' => rand(1, 1000)];
            $rand_url = 'some_url_' . rand(0, 1000);
            $type_id = rand(0, 1);
            $user_id = 1;
            $notification = Notifier::notify($user_id, $type_id, $data, $rand_url);
            if (rand(0, 1)) {
                $notification->seen = 1;
                $notification->seen_at = Carbon::today()->subDays(rand(1, 400));
                $notification->save();
            }
        }
        echo "<br>done!";
    });
});