Class 'PushManager' 未找到 - Laravel 4.2
Class 'PushManager' not found - Laravel 4.2
我正在 laravel 4.2 并且正在尝试安装 https://github.com/Ph3nol/NotificationPusher
安装的很好但是我运行进入错误:
Symfony \ Component \ Debug \ Exception \ FatalErrorException (E_UNKNOWN)
Class 'PushManager' not found
当我运行 /push 路由如下:
Route::get('push', function(){
// First, instantiate the manager and declare an adapter.
$pushManager = new PushManager();
$exampleAdapter = new ApnsAdapter();
// Set the device(s) to push the notification to.
$devices = new DeviceCollection(array(
new Device('Token1'),
new Device('Token2'),
new Device('Token3'),
// ...
));
// Then, create the push skel.
$message = new Message('This is an example.');
// Finally, create and add the push to the manager, and push it!
$push = new Push($exampleAdapter, $devices, $message);
$pushManager->add($push);
return $pushManager->push();
});
我可以错过一步吗? (也许在我的 app.php 中声明提供者或别名)
在 routes.php 的顶部添加以下内容:
use Sly\NotificationPusher\PushManager;
use Sly\NotificationPusher\Adapter\Apns as ApnsAdapter;
路由在全局命名空间中定义,PushManager存储在另一个命名空间中,因此需要显式导入。
我正在 laravel 4.2 并且正在尝试安装 https://github.com/Ph3nol/NotificationPusher
安装的很好但是我运行进入错误:
Symfony \ Component \ Debug \ Exception \ FatalErrorException (E_UNKNOWN)
Class 'PushManager' not found
当我运行 /push 路由如下:
Route::get('push', function(){
// First, instantiate the manager and declare an adapter.
$pushManager = new PushManager();
$exampleAdapter = new ApnsAdapter();
// Set the device(s) to push the notification to.
$devices = new DeviceCollection(array(
new Device('Token1'),
new Device('Token2'),
new Device('Token3'),
// ...
));
// Then, create the push skel.
$message = new Message('This is an example.');
// Finally, create and add the push to the manager, and push it!
$push = new Push($exampleAdapter, $devices, $message);
$pushManager->add($push);
return $pushManager->push();
});
我可以错过一步吗? (也许在我的 app.php 中声明提供者或别名)
在 routes.php 的顶部添加以下内容:
use Sly\NotificationPusher\PushManager;
use Sly\NotificationPusher\Adapter\Apns as ApnsAdapter;
路由在全局命名空间中定义,PushManager存储在另一个命名空间中,因此需要显式导入。