| 1 |
<?php |
| 2 |
|
| 3 |
namespace FluentForm\Framework\Foundation; |
| 4 |
|
| 5 |
use FluentForm\Framework\Foundation\Provider; |
| 6 |
|
| 7 |
class AppProvider extends Provider |
| 8 |
{ |
| 9 |
/** |
| 10 |
* The provider booting method to boot this provider |
| 11 |
* @return void |
| 12 |
*/ |
| 13 |
public function booting() |
| 14 |
{ |
| 15 |
$this->app->bind( |
| 16 |
'app', $this->app, 'App', 'FluentForm\Framework\Foundation\Application' |
| 17 |
); |
| 18 |
|
| 19 |
// Framework is booted and ready |
| 20 |
$this->app->booted(function($app) { |
| 21 |
$app->load($app->appPath('Global/Common.php')); |
| 22 |
}); |
| 23 |
} |
| 24 |
|
| 25 |
/** |
| 26 |
* The provider booted method to be called after booting |
| 27 |
* @return void |
| 28 |
*/ |
| 29 |
public function booted() |
| 30 |
{ |
| 31 |
// Application is booted and ready |
| 32 |
$this->app->ready(function($app) { |
| 33 |
$app->load($app->appPath('Hooks/Common.php')); |
| 34 |
if ($app->isUserOnAdminArea()) { |
| 35 |
$app->load($app->appPath('Hooks/Ajax.php')); |
| 36 |
$app->load($app->appPath('Hooks/Backend.php')); |
| 37 |
} else { |
| 38 |
$app->load($app->appPath('Hooks/Frontend.php')); |
| 39 |
} |
| 40 |
}); |
| 41 |
} |
| 42 |
} |
| 43 |
|