notification files
This commit is contained in:
43
app/Http/ViewComposers/Notifications.php
Normal file
43
app/Http/ViewComposers/Notifications.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\ViewComposers;
|
||||
|
||||
use Route;
|
||||
use Illuminate\View\View;
|
||||
use App\Traits\Modules as RemoteModules;
|
||||
|
||||
class Notifications
|
||||
{
|
||||
use RemoteModules;
|
||||
|
||||
/**
|
||||
* Bind data to the view.
|
||||
*
|
||||
* @param View $view
|
||||
* @return void
|
||||
*/
|
||||
public function compose(View $view)
|
||||
{
|
||||
// No need to add suggestions in console
|
||||
if (app()->runningInConsole() || !env('APP_INSTALLED')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$path = Route::current()->uri();
|
||||
|
||||
if (empty($path)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$notifications = $this->getNotifications($path);
|
||||
|
||||
if (empty($notifications)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Push to a stack
|
||||
foreach ($notifications as $notification) {
|
||||
$view->getFactory()->startPush('content_content_start', $notification->message);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user