app/Events/CounterEvent.php
/**
     * Get the data to broadcast.
     *
     * @return array
     */
Get the data to broadcast.
@return array
Get the data to broadcast . @return array
public function broadcastWith()
    {
        $counter = Counter::first();
        if (!$counter) {
            $counter = Counter::create();
        }
        $counter->{$this->type}('counter');
        return [
            'counter' => $counter->counter,
            'type' => $this->type,
        ];
    }
public function broadcastWith ( ) { $ counter = Counter :: first ( ) ; if ( ! $ counter ) { $ counter = Counter :: create ( ) ; } $ counter -> { $ this -> type } ( 'counter' ) ; return [ 'counter' => $ counter -> counter , 'type' => $ this -> type , ] ; }
Get the data to broadcast.
Get the data to broadcast .