| 
									
										
										
										
											2016-09-16 06:19:40 +02:00
										 |  |  | <?php | 
					
						
							| 
									
										
										
										
											2016-09-17 07:57:32 +02:00
										 |  |  | /** | 
					
						
							|  |  |  |  * BroadcastServiceProvider.php | 
					
						
							|  |  |  |  * Copyright (C) 2016 thegrumpydictator@gmail.com | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2016-10-05 06:52:15 +02:00
										 |  |  |  * This software may be modified and distributed under the terms of the | 
					
						
							|  |  |  |  * Creative Commons Attribution-ShareAlike 4.0 International License. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * See the LICENSE file for details. | 
					
						
							| 
									
										
										
										
											2016-09-17 07:57:32 +02:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2017-04-09 07:44:22 +02:00
										 |  |  | declare(strict_types=1); | 
					
						
							| 
									
										
										
										
											2016-09-16 06:19:40 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | namespace FireflyIII\Providers; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | use Illuminate\Support\Facades\Broadcast; | 
					
						
							| 
									
										
										
										
											2016-09-16 12:07:45 +02:00
										 |  |  | use Illuminate\Support\ServiceProvider; | 
					
						
							| 
									
										
										
										
											2016-09-16 06:19:40 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-17 07:57:32 +02:00
										 |  |  | /** | 
					
						
							|  |  |  |  * Class BroadcastServiceProvider | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @package FireflyIII\Providers | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2016-09-16 06:19:40 +02:00
										 |  |  | class BroadcastServiceProvider extends ServiceProvider | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Bootstrap any application services. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return void | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function boot() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         Broadcast::routes(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         /* | 
					
						
							|  |  |  |          * Authenticate the user's personal channel... | 
					
						
							|  |  |  |          */ | 
					
						
							| 
									
										
										
										
											2016-09-16 12:07:45 +02:00
										 |  |  |         Broadcast::channel( | 
					
						
							|  |  |  |             'App.User.*', function ($user, $userId) { | 
					
						
							|  |  |  |             return (int)$user->id === (int)$userId; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         ); | 
					
						
							| 
									
										
										
										
											2016-09-16 06:19:40 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | } |