| 
									
										
										
										
											2016-03-03 09:02:04 +01:00
										 |  |  | <?php | 
					
						
							| 
									
										
										
										
											2016-05-20 12:41:23 +02:00
										 |  |  | /** | 
					
						
							|  |  |  |  * RuleServiceProvider.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-05-20 12:41:23 +02:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-09 07:44:22 +02:00
										 |  |  | declare(strict_types=1); | 
					
						
							| 
									
										
										
										
											2016-05-20 08:57:45 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-03 09:02:04 +01:00
										 |  |  | namespace FireflyIII\Providers; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-05 15:58:27 +01:00
										 |  |  | use FireflyIII\Repositories\Rule\RuleRepository; | 
					
						
							|  |  |  | use FireflyIII\Repositories\Rule\RuleRepositoryInterface; | 
					
						
							| 
									
										
										
										
											2016-03-03 09:02:04 +01:00
										 |  |  | use Illuminate\Foundation\Application; | 
					
						
							|  |  |  | use Illuminate\Support\ServiceProvider; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * Class RuleServiceProvider | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @package FireflyIII\Providers | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | class RuleServiceProvider extends ServiceProvider | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Bootstrap the application services. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return void | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function boot() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         //
 | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Register the application services. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return void | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function register() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         $this->app->bind( | 
					
						
							| 
									
										
										
										
											2017-02-05 15:58:27 +01:00
										 |  |  |             RuleRepositoryInterface::class, | 
					
						
							|  |  |  |             function (Application $app) { | 
					
						
							|  |  |  |                 /** @var RuleRepository $repository */ | 
					
						
							|  |  |  |                 $repository = app(RuleRepository::class); | 
					
						
							|  |  |  |                 if ($app->auth->check()) { | 
					
						
							|  |  |  |                     $repository->setUser(auth()->user()); | 
					
						
							| 
									
										
										
										
											2016-04-28 05:50:29 +02:00
										 |  |  |                 } | 
					
						
							| 
									
										
										
										
											2017-02-17 06:42:36 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-05 15:58:27 +01:00
										 |  |  |                 return $repository; | 
					
						
							| 
									
										
										
										
											2016-03-03 09:02:04 +01:00
										 |  |  |             } | 
					
						
							|  |  |  |         ); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } |