<?php

namespace App\Events;

use App\Http\Controllers\Controller;
use App\Package;
use Illuminate\Broadcasting\Channel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Queue\SerializesModels;
use Illuminate\Broadcasting\PrivateChannel;

class WeighedEvent implements ShouldBroadcast
{
    use  SerializesModels;

    public $package;

    /**
     * Create a new event instance.
     *
     * @return void
     */
    public function __construct(Package $package)
    {
        $this->package=$package;
    }

    /**
     * Get the channels the event should broadcast on.
     *
     * @return \Illuminate\Broadcasting\Channel|array
     */
    public function broadcastOn()
    {
        return new Channel('package');
    }
//
//    public function broadcastAs(){
//        return "weight";        //频道别名
//    }

}
