コード例 #1
0
 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     Broadcast::routes();
     /*
      * Authenticate the user's personal channel...
      */
     Broadcast::channel('App.User.*', function ($user, $userId) {
         return (int) $user->id === (int) $userId;
     });
 }
コード例 #2
0
 /**
  * Get a default broadcast value, if any is available
  *
  * @return Broadcaster|null A default broadcast value or Null if no default value is available
  */
 public function getDefaultBroadcast()
 {
     // By default, the Broadcast Facade does not return the
     // any actual broadcaster, but rather an
     // instance of a manager.
     // Therefore, we make sure only to obtain its
     // "broadcaster", to make sure that its only the
     // connection is obtained!
     $manager = Broadcast::getFacadeRoot();
     if (!is_null($manager)) {
         return $manager->connection();
     }
     return $manager;
 }
コード例 #3
0
 /**
  * Get a default broadcast factory value, if any is available
  *
  * @return Factory|null A default broadcast factory value or Null if no default value is available
  */
 public function getDefaultBroadcastFactory()
 {
     return Broadcast::getFacadeRoot();
 }
コード例 #4
0
 /**
  * Store the socket ID for the current user.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return void
  */
 public function rememberSocket(Request $request)
 {
     return Broadcast::rememberSocket($request);
 }
コード例 #5
0
 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     Broadcast::routes();
 }
コード例 #6
0
 /**
  * Exclude the current user from receiving the broadcast.
  *
  * @return $this
  */
 public function dontBroadcastToCurrentUser()
 {
     $this->socket = Broadcast::socket();
     return $this;
 }
コード例 #7
0
 /**
  * Exclude the current user from receiving the broadcast.
  *
  * @return $this
  */
 public function exceptCurrentUser()
 {
     $this->socket = Broadcast::socket();
     return $this;
 }
コード例 #8
0
 /**
  * Authenticate the request for channel access.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function authenticate(Request $request)
 {
     return Broadcast::auth($request);
 }