src/Controller/Panel/DashboardController.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Panel;
  3. use Symfony\Component\Messenger\Bridge\Amqp\Transport\AmqpStamp;
  4. use App\Message\SmsNotification;
  5. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
  6. use Symfony\Component\Messenger\MessageBusInterface;
  7. use Symfony\Component\Routing\Annotation\Route;
  8. class DashboardController extends SharedController
  9. {
  10.     /**
  11.      * @Route("/%panel_path%/", name="panel.dashboard.index")
  12.      * @Security("is_granted('ROLE_PANEL')")
  13.      */
  14.     public function index(MessageBusInterface $bus) {
  15.         if (!$this->permissions->Dashboard->read) { return $this->breach_of_authority(); exit; }
  16.         $this->my_session->set('active_page','panel.dashboard.index');
  17.         $this->my_session->set('active_page_title','Dashboard');
  18.         //$bus->dispatch(new SmsNotification('Look! I created a message!'));
  19.         $attributes = [];
  20.         $bus->dispatch(new SmsNotification('Look! I created a message!'), [
  21.             new AmqpStamp('custom-routing-key'0$attributes),
  22.         ]);
  23.         return $this->shared_render('dashboard/index');
  24.     }
  25. }