title: How to define event with controller method in laravel web.php file?
body: <p>I have define controller method call in web.php as below.</p>
  
  <pre><code>Route::post('/order', 'OrderController@create');
  </code></pre>
  
  <p>I want to call event when OrderController@create method called. How can i do that? My event call is</p>
  
  <pre><code>event(new NewOrderAdded());
  </code></pre>
  
  <p>Here is my event class.</p>
  
  <pre><code>class NewOrderAdded implements ShouldBroadcast
  {
      use Dispatchable, InteractsWithSockets, SerializesModels;
  
      /**
       * Create a new event instance.
       *
       * @return void
       */
      public function __construct()
      {
          //
      }
  
      /**
       * Get the channels the event should broadcast on.
       *
       * @return \Illuminate\Broadcasting\Channel|array
       */
      public function broadcastOn()
      {
          return new Channel('public-test-channel');
      }
  }
  </code></pre>
  
  <p>Controller class</p>
  
  <pre><code>class OrderController extends Controller
  {
    public function create(Request $request){
      $order = new Order([
        'user_id' =&gt; $request-&gt;get('user_id'),
        'person_id' =&gt; json_encode($request-&gt;get('person_id')),
        'date_of_booking' =&gt; $request-&gt;get('date_of_booking'),
        'total_order_price' =&gt;$request-&gt;get('total_order_price'),
        'ticket_id' =&gt; json_encode($request-&gt;get('ticket_id')),
        'timeslot' =&gt; $request-&gt;get('timeslot'),
        'status' =&gt; 'pending',
        'add_on_id' =&gt; json_encode($request-&gt;get('add_on_id'))
      ]);
      $order-&gt;save();
      event(new NewOrderAdded($order));
      return response()-&gt;json(array('order_id'=&gt;$order-&gt;id));
    }
  }
  </code></pre>
  
  <p>Here is the clas where i want to receive event.
  ViewBookings.vue</p>
  
  <pre><code>&lt;script&gt;
  import moment from 'moment';
  export default{
    data(){
      return{
        users:[]
      }
    },
    created:function(){
      this.listen();
    },
    methods:{
      listen(){
        Echo.channel('public-test-channel')
              .listen('NewOrderAdded', (data) =&gt; {
                console.log("Event received");
              });
      }
    }
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>I tried this code but i am not able to receive events in ViewBookings.vue class. Please suggest what is the issue here.</p>