PHP code example of alfred-nutile-inc / notifications
1. Go to this page and download the library: Download alfred-nutile-inc/notifications library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
alfred-nutile-inc / notifications example snippets
namespace Foo
use AlfredNutileInc\CoreApp\Notifications\NotificationFacade as Notify;
Notify::setRead(-1)->getAll();
Notify::setRead(0)->setLimit(20)->setFromId('mock-project-1')->to('mock-user-1');
~~~
You can also enerTest.php)
# Sending Notifications with NotificationHelper
In this example, a "Tactic" sends a notification to itself in order to later be displayed on a Tactic "activity" page.
->setRecipients can be called multiple times with different sender types, so you could send the notification to multiple different models all at once.
# Plug it into Angular
Base blade file
~~~
use AlfredNutileInc\CoreApp\Notifications\NotificationFacade as Notify;
/**
* @Middleware("auth")
*/
class AngularController extends BaseController {
/**
* @Get("approve", as="approve.dash")
*/
public function index()
{
$chat_on = getenv('CHAT_ON');
$message = Notify::setRead(0)->setLimit(10)->getAll();
JavaScript::put(
[
'pusher_public_key' => getenv('PUSHER_PUBLIC'),
'sauce_key' => getenv('SAUCE_TOKEN'),
'sauce_user' => getenv('SAUCE_USER'),
'token' => csrf_token(),
'profile' => User::profile(),
'environment' => getenv('APP_ENV'),
'messages' => $message
]
);
return View::make('layouts/main', compact('chat_on'));
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.