@@ -10,65 +10,65 @@ |
||
| 10 | 10 | |
| 11 | 11 | class NotificationController extends BaseApiController |
| 12 | 12 | { |
| 13 | - /** |
|
| 14 | - * List of all route actions that the base api controller |
|
| 15 | - * will skip permissions check for them. |
|
| 16 | - * @var array |
|
| 17 | - */ |
|
| 18 | - protected $skipPermissionCheck = ['markAsRead', 'markAllAsRead', 'index', 'unread']; |
|
| 13 | + /** |
|
| 14 | + * List of all route actions that the base api controller |
|
| 15 | + * will skip permissions check for them. |
|
| 16 | + * @var array |
|
| 17 | + */ |
|
| 18 | + protected $skipPermissionCheck = ['markAsRead', 'markAllAsRead', 'index', 'unread']; |
|
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * Init new object. |
|
| 22 | - * |
|
| 23 | - * @param NotificationRepository $repo |
|
| 24 | - * @param CoreConfig $config |
|
| 25 | - * @return void |
|
| 26 | - */ |
|
| 27 | - public function __construct(NotificationRepository $repo, CoreConfig $config) |
|
| 28 | - { |
|
| 29 | - parent::__construct($repo, $config, 'App\Modules\Notifications\Http\Resources\Notification'); |
|
| 30 | - } |
|
| 20 | + /** |
|
| 21 | + * Init new object. |
|
| 22 | + * |
|
| 23 | + * @param NotificationRepository $repo |
|
| 24 | + * @param CoreConfig $config |
|
| 25 | + * @return void |
|
| 26 | + */ |
|
| 27 | + public function __construct(NotificationRepository $repo, CoreConfig $config) |
|
| 28 | + { |
|
| 29 | + parent::__construct($repo, $config, 'App\Modules\Notifications\Http\Resources\Notification'); |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * Retrieve all notifications of the logged in user. |
|
| 34 | - * |
|
| 35 | - * @param Request $request |
|
| 36 | - * @return \Illuminate\Http\Response |
|
| 37 | - */ |
|
| 38 | - public function index(Request $request) |
|
| 39 | - { |
|
| 40 | - return $this->modelResource::collection($this->repo->my($request->query('perPage'))); |
|
| 41 | - } |
|
| 32 | + /** |
|
| 33 | + * Retrieve all notifications of the logged in user. |
|
| 34 | + * |
|
| 35 | + * @param Request $request |
|
| 36 | + * @return \Illuminate\Http\Response |
|
| 37 | + */ |
|
| 38 | + public function index(Request $request) |
|
| 39 | + { |
|
| 40 | + return $this->modelResource::collection($this->repo->my($request->query('perPage'))); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * Retrieve unread notifications of the logged in user. |
|
| 45 | - * |
|
| 46 | - * @param Request $request |
|
| 47 | - * @return \Illuminate\Http\Response |
|
| 48 | - */ |
|
| 49 | - public function unread(Request $request) |
|
| 50 | - { |
|
| 51 | - return $this->modelResource::collection($this->repo->unread($request->query('perPage'))); |
|
| 52 | - } |
|
| 43 | + /** |
|
| 44 | + * Retrieve unread notifications of the logged in user. |
|
| 45 | + * |
|
| 46 | + * @param Request $request |
|
| 47 | + * @return \Illuminate\Http\Response |
|
| 48 | + */ |
|
| 49 | + public function unread(Request $request) |
|
| 50 | + { |
|
| 51 | + return $this->modelResource::collection($this->repo->unread($request->query('perPage'))); |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * Mark the notification as read. |
|
| 56 | - * |
|
| 57 | - * @param integer $id Id of the notification. |
|
| 58 | - * @return \Illuminate\Http\Response |
|
| 59 | - */ |
|
| 60 | - public function markAsRead($id) |
|
| 61 | - { |
|
| 62 | - return new GeneralResource($this->repo->markAsRead($id)); |
|
| 63 | - } |
|
| 54 | + /** |
|
| 55 | + * Mark the notification as read. |
|
| 56 | + * |
|
| 57 | + * @param integer $id Id of the notification. |
|
| 58 | + * @return \Illuminate\Http\Response |
|
| 59 | + */ |
|
| 60 | + public function markAsRead($id) |
|
| 61 | + { |
|
| 62 | + return new GeneralResource($this->repo->markAsRead($id)); |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - /** |
|
| 66 | - * Mark all notifications as read. |
|
| 67 | - * |
|
| 68 | - * @return \Illuminate\Http\Response |
|
| 69 | - */ |
|
| 70 | - public function markAllAsRead() |
|
| 71 | - { |
|
| 72 | - return new GeneralResource($this->repo->markAllAsRead()); |
|
| 73 | - } |
|
| 65 | + /** |
|
| 66 | + * Mark all notifications as read. |
|
| 67 | + * |
|
| 68 | + * @return \Illuminate\Http\Response |
|
| 69 | + */ |
|
| 70 | + public function markAllAsRead() |
|
| 71 | + { |
|
| 72 | + return new GeneralResource($this->repo->markAllAsRead()); |
|
| 73 | + } |
|
| 74 | 74 | } |
@@ -4,26 +4,26 @@ |
||
| 4 | 4 | |
| 5 | 5 | class Core implements BaseFactoryInterface |
| 6 | 6 | { |
| 7 | - /** |
|
| 8 | - * Construct the repository class name based on |
|
| 9 | - * the method name called, search in the |
|
| 10 | - * given namespaces for the class and |
|
| 11 | - * return an instance. |
|
| 12 | - * |
|
| 13 | - * @param string $name the called method name |
|
| 14 | - * @param array $arguments the method arguments |
|
| 15 | - * @return object |
|
| 16 | - */ |
|
| 17 | - public function __call($name, $arguments) |
|
| 18 | - { |
|
| 19 | - foreach (\Module::all() as $module) { |
|
| 20 | - $nameSpace = 'App\\Modules\\' . $module['basename'] ; |
|
| 21 | - $model = ucfirst(\Str::singular($name)); |
|
| 22 | - $class = $nameSpace . '\\Repositories\\' . $model . 'Repository'; |
|
| 7 | + /** |
|
| 8 | + * Construct the repository class name based on |
|
| 9 | + * the method name called, search in the |
|
| 10 | + * given namespaces for the class and |
|
| 11 | + * return an instance. |
|
| 12 | + * |
|
| 13 | + * @param string $name the called method name |
|
| 14 | + * @param array $arguments the method arguments |
|
| 15 | + * @return object |
|
| 16 | + */ |
|
| 17 | + public function __call($name, $arguments) |
|
| 18 | + { |
|
| 19 | + foreach (\Module::all() as $module) { |
|
| 20 | + $nameSpace = 'App\\Modules\\' . $module['basename'] ; |
|
| 21 | + $model = ucfirst(\Str::singular($name)); |
|
| 22 | + $class = $nameSpace . '\\Repositories\\' . $model . 'Repository'; |
|
| 23 | 23 | |
| 24 | - if (class_exists($class)) { |
|
| 25 | - return \App::make($class); |
|
| 26 | - } |
|
| 27 | - } |
|
| 28 | - } |
|
| 24 | + if (class_exists($class)) { |
|
| 25 | + return \App::make($class); |
|
| 26 | + } |
|
| 27 | + } |
|
| 28 | + } |
|
| 29 | 29 | } |
@@ -17,9 +17,9 @@ |
||
| 17 | 17 | public function __call($name, $arguments) |
| 18 | 18 | { |
| 19 | 19 | foreach (\Module::all() as $module) { |
| 20 | - $nameSpace = 'App\\Modules\\' . $module['basename'] ; |
|
| 20 | + $nameSpace = 'App\\Modules\\'.$module['basename']; |
|
| 21 | 21 | $model = ucfirst(\Str::singular($name)); |
| 22 | - $class = $nameSpace . '\\Repositories\\' . $model . 'Repository'; |
|
| 22 | + $class = $nameSpace.'\\Repositories\\'.$model.'Repository'; |
|
| 23 | 23 | |
| 24 | 24 | if (class_exists($class)) { |
| 25 | 25 | return \App::make($class); |
@@ -13,11 +13,11 @@ |
||
| 13 | 13 | |
| 14 | 14 | Route::group(['prefix' => 'settings'], function () { |
| 15 | 15 | |
| 16 | - Route::get('/', 'SettingController@index'); |
|
| 17 | - Route::get('/{id}', 'SettingController@find'); |
|
| 18 | - Route::put('/', 'SettingController@update'); |
|
| 19 | - Route::delete('/{id}', 'SettingController@delete'); |
|
| 20 | - Route::get('list/deleted', 'SettingController@deleted'); |
|
| 21 | - Route::patch('restore/{id}', 'SettingController@restore'); |
|
| 22 | - Route::post('save/many', 'SettingController@saveMany'); |
|
| 16 | + Route::get('/', 'SettingController@index'); |
|
| 17 | + Route::get('/{id}', 'SettingController@find'); |
|
| 18 | + Route::put('/', 'SettingController@update'); |
|
| 19 | + Route::delete('/{id}', 'SettingController@delete'); |
|
| 20 | + Route::get('list/deleted', 'SettingController@deleted'); |
|
| 21 | + Route::patch('restore/{id}', 'SettingController@restore'); |
|
| 22 | + Route::post('save/many', 'SettingController@saveMany'); |
|
| 23 | 23 | }); |
| 24 | 24 | \ No newline at end of file |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | | |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | -Route::group(['prefix' => 'settings'], function () { |
|
| 14 | +Route::group(['prefix' => 'settings'], function() { |
|
| 15 | 15 | |
| 16 | 16 | Route::get('/', 'SettingController@index'); |
| 17 | 17 | Route::get('/{id}', 'SettingController@find'); |
@@ -6,53 +6,53 @@ |
||
| 6 | 6 | |
| 7 | 7 | class ModuleServiceProvider extends ServiceProvider |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * Bootstrap the module services. |
|
| 11 | - * |
|
| 12 | - * @return void |
|
| 13 | - */ |
|
| 14 | - public function boot() |
|
| 15 | - { |
|
| 16 | - $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'core'); |
|
| 17 | - $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'core'); |
|
| 18 | - |
|
| 19 | - $this->loadMigrationsFrom(module_path('core', 'Database/Migrations', 'app')); |
|
| 20 | - $this->loadFactoriesFrom(module_path('core', 'Database/Factories', 'app')); |
|
| 21 | - } |
|
| 22 | - |
|
| 23 | - /** |
|
| 24 | - * Register the module services. |
|
| 25 | - * |
|
| 26 | - * @return void |
|
| 27 | - */ |
|
| 28 | - public function register() |
|
| 29 | - { |
|
| 30 | - //Bind Core Facade to the Service Container |
|
| 31 | - $this->app->singleton('Core', function () { |
|
| 32 | - return new \App\Modules\Core\Core; |
|
| 33 | - }); |
|
| 34 | - |
|
| 35 | - //Bind ErrorHandler Facade to the Service Container |
|
| 36 | - $this->app->singleton('ErrorHandler', function () { |
|
| 37 | - return new \App\Modules\Core\Utl\ErrorHandler; |
|
| 38 | - }); |
|
| 39 | - |
|
| 40 | - //Bind CoreConfig Facade to the Service Container |
|
| 41 | - $this->app->singleton('CoreConfig', function () { |
|
| 42 | - return new \App\Modules\Core\Utl\CoreConfig; |
|
| 43 | - }); |
|
| 44 | - |
|
| 45 | - //Bind Media Facade to the Service Container |
|
| 46 | - $this->app->singleton('Media', function () { |
|
| 47 | - return new \App\Modules\Core\Utl\Media; |
|
| 48 | - }); |
|
| 49 | - |
|
| 50 | - //Bind ApiConsumer Facade to the Service Container |
|
| 51 | - $this->app->singleton('ApiConsumer', function () { |
|
| 52 | - $app = app(); |
|
| 53 | - return new \App\Modules\Core\Utl\ApiConsumer($app, $app['request'], $app['router']); |
|
| 54 | - }); |
|
| 9 | + /** |
|
| 10 | + * Bootstrap the module services. |
|
| 11 | + * |
|
| 12 | + * @return void |
|
| 13 | + */ |
|
| 14 | + public function boot() |
|
| 15 | + { |
|
| 16 | + $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'core'); |
|
| 17 | + $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'core'); |
|
| 18 | + |
|
| 19 | + $this->loadMigrationsFrom(module_path('core', 'Database/Migrations', 'app')); |
|
| 20 | + $this->loadFactoriesFrom(module_path('core', 'Database/Factories', 'app')); |
|
| 21 | + } |
|
| 22 | + |
|
| 23 | + /** |
|
| 24 | + * Register the module services. |
|
| 25 | + * |
|
| 26 | + * @return void |
|
| 27 | + */ |
|
| 28 | + public function register() |
|
| 29 | + { |
|
| 30 | + //Bind Core Facade to the Service Container |
|
| 31 | + $this->app->singleton('Core', function () { |
|
| 32 | + return new \App\Modules\Core\Core; |
|
| 33 | + }); |
|
| 34 | + |
|
| 35 | + //Bind ErrorHandler Facade to the Service Container |
|
| 36 | + $this->app->singleton('ErrorHandler', function () { |
|
| 37 | + return new \App\Modules\Core\Utl\ErrorHandler; |
|
| 38 | + }); |
|
| 39 | + |
|
| 40 | + //Bind CoreConfig Facade to the Service Container |
|
| 41 | + $this->app->singleton('CoreConfig', function () { |
|
| 42 | + return new \App\Modules\Core\Utl\CoreConfig; |
|
| 43 | + }); |
|
| 44 | + |
|
| 45 | + //Bind Media Facade to the Service Container |
|
| 46 | + $this->app->singleton('Media', function () { |
|
| 47 | + return new \App\Modules\Core\Utl\Media; |
|
| 48 | + }); |
|
| 49 | + |
|
| 50 | + //Bind ApiConsumer Facade to the Service Container |
|
| 51 | + $this->app->singleton('ApiConsumer', function () { |
|
| 52 | + $app = app(); |
|
| 53 | + return new \App\Modules\Core\Utl\ApiConsumer($app, $app['request'], $app['router']); |
|
| 54 | + }); |
|
| 55 | 55 | |
| 56 | - $this->app->register(RouteServiceProvider::class); |
|
| 57 | - } |
|
| 56 | + $this->app->register(RouteServiceProvider::class); |
|
| 57 | + } |
|
| 58 | 58 | } |
@@ -28,27 +28,27 @@ |
||
| 28 | 28 | public function register() |
| 29 | 29 | { |
| 30 | 30 | //Bind Core Facade to the Service Container |
| 31 | - $this->app->singleton('Core', function () { |
|
| 31 | + $this->app->singleton('Core', function() { |
|
| 32 | 32 | return new \App\Modules\Core\Core; |
| 33 | 33 | }); |
| 34 | 34 | |
| 35 | 35 | //Bind ErrorHandler Facade to the Service Container |
| 36 | - $this->app->singleton('ErrorHandler', function () { |
|
| 36 | + $this->app->singleton('ErrorHandler', function() { |
|
| 37 | 37 | return new \App\Modules\Core\Utl\ErrorHandler; |
| 38 | 38 | }); |
| 39 | 39 | |
| 40 | 40 | //Bind CoreConfig Facade to the Service Container |
| 41 | - $this->app->singleton('CoreConfig', function () { |
|
| 41 | + $this->app->singleton('CoreConfig', function() { |
|
| 42 | 42 | return new \App\Modules\Core\Utl\CoreConfig; |
| 43 | 43 | }); |
| 44 | 44 | |
| 45 | 45 | //Bind Media Facade to the Service Container |
| 46 | - $this->app->singleton('Media', function () { |
|
| 46 | + $this->app->singleton('Media', function() { |
|
| 47 | 47 | return new \App\Modules\Core\Utl\Media; |
| 48 | 48 | }); |
| 49 | 49 | |
| 50 | 50 | //Bind ApiConsumer Facade to the Service Container |
| 51 | - $this->app->singleton('ApiConsumer', function () { |
|
| 51 | + $this->app->singleton('ApiConsumer', function() { |
|
| 52 | 52 | $app = app(); |
| 53 | 53 | return new \App\Modules\Core\Utl\ApiConsumer($app, $app['request'], $app['router']); |
| 54 | 54 | }); |
@@ -5,116 +5,116 @@ |
||
| 5 | 5 | |
| 6 | 6 | class CachingDecorator |
| 7 | 7 | { |
| 8 | - /** |
|
| 9 | - * The repo implementation. |
|
| 10 | - * |
|
| 11 | - * @var string |
|
| 12 | - */ |
|
| 13 | - public $repo; |
|
| 8 | + /** |
|
| 9 | + * The repo implementation. |
|
| 10 | + * |
|
| 11 | + * @var string |
|
| 12 | + */ |
|
| 13 | + public $repo; |
|
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * The cache implementation. |
|
| 17 | - * |
|
| 18 | - * @var object |
|
| 19 | - */ |
|
| 20 | - protected $cache; |
|
| 15 | + /** |
|
| 16 | + * The cache implementation. |
|
| 17 | + * |
|
| 18 | + * @var object |
|
| 19 | + */ |
|
| 20 | + protected $cache; |
|
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * The modelKey implementation. |
|
| 24 | - * |
|
| 25 | - * @var string |
|
| 26 | - */ |
|
| 27 | - public $modelKey; |
|
| 22 | + /** |
|
| 23 | + * The modelKey implementation. |
|
| 24 | + * |
|
| 25 | + * @var string |
|
| 26 | + */ |
|
| 27 | + public $modelKey; |
|
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * The model implementation. |
|
| 31 | - * |
|
| 32 | - * @var string |
|
| 33 | - */ |
|
| 34 | - public $model; |
|
| 29 | + /** |
|
| 30 | + * The model implementation. |
|
| 31 | + * |
|
| 32 | + * @var string |
|
| 33 | + */ |
|
| 34 | + public $model; |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * The modelClass implementation. |
|
| 38 | - * |
|
| 39 | - * @var string |
|
| 40 | - */ |
|
| 41 | - public $modelClass; |
|
| 36 | + /** |
|
| 37 | + * The modelClass implementation. |
|
| 38 | + * |
|
| 39 | + * @var string |
|
| 40 | + */ |
|
| 41 | + public $modelClass; |
|
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * The cacheConfig implementation. |
|
| 45 | - * |
|
| 46 | - * @var mixed |
|
| 47 | - */ |
|
| 48 | - public $cacheConfig; |
|
| 43 | + /** |
|
| 44 | + * The cacheConfig implementation. |
|
| 45 | + * |
|
| 46 | + * @var mixed |
|
| 47 | + */ |
|
| 48 | + public $cacheConfig; |
|
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * The cacheTag implementation. |
|
| 52 | - * |
|
| 53 | - * @var string |
|
| 54 | - */ |
|
| 55 | - public $cacheTag; |
|
| 50 | + /** |
|
| 51 | + * The cacheTag implementation. |
|
| 52 | + * |
|
| 53 | + * @var string |
|
| 54 | + */ |
|
| 55 | + public $cacheTag; |
|
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * Init new object. |
|
| 59 | - * |
|
| 60 | - * @param string $repo |
|
| 61 | - * @param Cache $cache |
|
| 62 | - * |
|
| 63 | - * @return void |
|
| 64 | - */ |
|
| 65 | - public function __construct($repo, Cache $cache) |
|
| 66 | - { |
|
| 67 | - $this->repo = $repo; |
|
| 68 | - $this->cache = $cache; |
|
| 69 | - $this->model = $this->repo->model; |
|
| 70 | - $this->modelClass = get_class($this->model); |
|
| 71 | - $repoClass = explode('\\', get_class($this->repo)); |
|
| 72 | - $repoName = end($repoClass); |
|
| 73 | - $this->cacheTag = lcfirst(substr($repoName, 0, strpos($repoName, 'Repository'))); |
|
| 74 | - } |
|
| 57 | + /** |
|
| 58 | + * Init new object. |
|
| 59 | + * |
|
| 60 | + * @param string $repo |
|
| 61 | + * @param Cache $cache |
|
| 62 | + * |
|
| 63 | + * @return void |
|
| 64 | + */ |
|
| 65 | + public function __construct($repo, Cache $cache) |
|
| 66 | + { |
|
| 67 | + $this->repo = $repo; |
|
| 68 | + $this->cache = $cache; |
|
| 69 | + $this->model = $this->repo->model; |
|
| 70 | + $this->modelClass = get_class($this->model); |
|
| 71 | + $repoClass = explode('\\', get_class($this->repo)); |
|
| 72 | + $repoName = end($repoClass); |
|
| 73 | + $this->cacheTag = lcfirst(substr($repoName, 0, strpos($repoName, 'Repository'))); |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - /** |
|
| 77 | - * Handle the cache mechanism for the called method |
|
| 78 | - * based the configurations. |
|
| 79 | - * |
|
| 80 | - * @param string $name the called method name |
|
| 81 | - * @param array $arguments the method arguments |
|
| 82 | - * @return object |
|
| 83 | - */ |
|
| 84 | - public function __call($name, $arguments) |
|
| 85 | - { |
|
| 86 | - $this->setCacheConfig($name); |
|
| 76 | + /** |
|
| 77 | + * Handle the cache mechanism for the called method |
|
| 78 | + * based the configurations. |
|
| 79 | + * |
|
| 80 | + * @param string $name the called method name |
|
| 81 | + * @param array $arguments the method arguments |
|
| 82 | + * @return object |
|
| 83 | + */ |
|
| 84 | + public function __call($name, $arguments) |
|
| 85 | + { |
|
| 86 | + $this->setCacheConfig($name); |
|
| 87 | 87 | |
| 88 | - if ($this->cacheConfig && $this->cacheConfig == 'cache') { |
|
| 89 | - $page = \Request::get('page') !== null ? \Request::get('page') : '1'; |
|
| 90 | - $cacheKey = $name.$page.\Session::get('locale').serialize($arguments); |
|
| 91 | - return $this->cache->tags([$this->cacheTag])->rememberForever($cacheKey, function () use ($arguments, $name) { |
|
| 92 | - return call_user_func_array([$this->repo, $name], $arguments); |
|
| 93 | - }); |
|
| 94 | - } elseif ($this->cacheConfig) { |
|
| 95 | - $this->cache->tags($this->cacheConfig)->flush(); |
|
| 96 | - return call_user_func_array([$this->repo, $name], $arguments); |
|
| 97 | - } |
|
| 88 | + if ($this->cacheConfig && $this->cacheConfig == 'cache') { |
|
| 89 | + $page = \Request::get('page') !== null ? \Request::get('page') : '1'; |
|
| 90 | + $cacheKey = $name.$page.\Session::get('locale').serialize($arguments); |
|
| 91 | + return $this->cache->tags([$this->cacheTag])->rememberForever($cacheKey, function () use ($arguments, $name) { |
|
| 92 | + return call_user_func_array([$this->repo, $name], $arguments); |
|
| 93 | + }); |
|
| 94 | + } elseif ($this->cacheConfig) { |
|
| 95 | + $this->cache->tags($this->cacheConfig)->flush(); |
|
| 96 | + return call_user_func_array([$this->repo, $name], $arguments); |
|
| 97 | + } |
|
| 98 | 98 | |
| 99 | - return call_user_func_array([$this->repo, $name], $arguments); |
|
| 100 | - } |
|
| 99 | + return call_user_func_array([$this->repo, $name], $arguments); |
|
| 100 | + } |
|
| 101 | 101 | |
| 102 | - /** |
|
| 103 | - * Set cache config based on the called method. |
|
| 104 | - * |
|
| 105 | - * @param string $name |
|
| 106 | - * @return void |
|
| 107 | - */ |
|
| 108 | - private function setCacheConfig($name) |
|
| 109 | - { |
|
| 110 | - $config = \CoreConfig::getConfig(); |
|
| 111 | - $cacheConfig = Arr::get($config['cacheConfig'], $this->cacheTag, false); |
|
| 112 | - $this->cacheConfig = false; |
|
| 102 | + /** |
|
| 103 | + * Set cache config based on the called method. |
|
| 104 | + * |
|
| 105 | + * @param string $name |
|
| 106 | + * @return void |
|
| 107 | + */ |
|
| 108 | + private function setCacheConfig($name) |
|
| 109 | + { |
|
| 110 | + $config = \CoreConfig::getConfig(); |
|
| 111 | + $cacheConfig = Arr::get($config['cacheConfig'], $this->cacheTag, false); |
|
| 112 | + $this->cacheConfig = false; |
|
| 113 | 113 | |
| 114 | - if ($cacheConfig && in_array($name, $cacheConfig['cache'])) { |
|
| 115 | - $this->cacheConfig = 'cache'; |
|
| 116 | - } elseif ($cacheConfig && isset($cacheConfig['clear'][$name])) { |
|
| 117 | - $this->cacheConfig = $cacheConfig['clear'][$name]; |
|
| 118 | - } |
|
| 119 | - } |
|
| 114 | + if ($cacheConfig && in_array($name, $cacheConfig['cache'])) { |
|
| 115 | + $this->cacheConfig = 'cache'; |
|
| 116 | + } elseif ($cacheConfig && isset($cacheConfig['clear'][$name])) { |
|
| 117 | + $this->cacheConfig = $cacheConfig['clear'][$name]; |
|
| 118 | + } |
|
| 119 | + } |
|
| 120 | 120 | } |
@@ -10,204 +10,204 @@ |
||
| 10 | 10 | |
| 11 | 11 | class BaseApiController extends Controller |
| 12 | 12 | { |
| 13 | - /** |
|
| 14 | - * The config implementation. |
|
| 15 | - * |
|
| 16 | - * @var array |
|
| 17 | - */ |
|
| 18 | - protected $config; |
|
| 19 | - |
|
| 20 | - /** |
|
| 21 | - * The relations implementation. |
|
| 22 | - * |
|
| 23 | - * @var array |
|
| 24 | - */ |
|
| 25 | - protected $relations; |
|
| 26 | - |
|
| 27 | - /** |
|
| 28 | - * The repo implementation. |
|
| 29 | - * |
|
| 30 | - * @var object |
|
| 31 | - */ |
|
| 32 | - protected $repo; |
|
| 33 | - |
|
| 34 | - /** |
|
| 35 | - * Init new object. |
|
| 36 | - * |
|
| 37 | - * @param mixed $repo |
|
| 38 | - * @param CoreConfig $config |
|
| 39 | - * @param string $modelResource |
|
| 40 | - * @return void |
|
| 41 | - */ |
|
| 42 | - public function __construct($repo, $config, $modelResource) |
|
| 43 | - { |
|
| 44 | - $this->repo = new CachingDecorator($repo, \App::make('Illuminate\Contracts\Cache\Repository')); |
|
| 45 | - $this->modelResource = $modelResource; |
|
| 46 | - $this->config = $config->getConfig(); |
|
| 47 | - $this->modelName = explode('\\', get_called_class()); |
|
| 48 | - $this->modelName = lcfirst(str_replace('Controller', '', end($this->modelName))); |
|
| 49 | - $this->validationRules = property_exists($this, 'validationRules') ? $this->validationRules : false; |
|
| 50 | - $this->skipPermissionCheck = property_exists($this, 'skipPermissionCheck') ? $this->skipPermissionCheck : []; |
|
| 51 | - $this->skipLoginCheck = property_exists($this, 'skipLoginCheck') ? $this->skipLoginCheck : []; |
|
| 52 | - $route = explode('@', \Route::currentRouteAction())[1]; |
|
| 53 | - |
|
| 54 | - $this->setSessions(); |
|
| 55 | - $this->checkPermission($route); |
|
| 56 | - $this->setRelations($route); |
|
| 57 | - } |
|
| 58 | - |
|
| 59 | - /** |
|
| 60 | - * Fetch all records with relations from storage. |
|
| 61 | - * |
|
| 62 | - * @param Request $request |
|
| 63 | - * @return \Illuminate\Http\Response |
|
| 64 | - */ |
|
| 65 | - public function index(Request $request) |
|
| 66 | - { |
|
| 67 | - return $this->modelResource::collection($this->repo->list($this->relations, $request->query(), $request->query('perPage'), $request->query('sortBy'), $request->query('desc'))); |
|
| 68 | - } |
|
| 69 | - |
|
| 70 | - /** |
|
| 71 | - * Fetch the single object with relations from storage. |
|
| 72 | - * |
|
| 73 | - * @param integer $id Id of the requested model. |
|
| 74 | - * @return \Illuminate\Http\Response |
|
| 75 | - */ |
|
| 76 | - public function find($id) |
|
| 77 | - { |
|
| 78 | - return new $this->modelResource($this->repo->find($id, $this->relations)); |
|
| 79 | - } |
|
| 80 | - |
|
| 81 | - /** |
|
| 82 | - * Delete by the given id from storage. |
|
| 83 | - * |
|
| 84 | - * @param integer $id Id of the deleted model. |
|
| 85 | - * @return \Illuminate\Http\Response |
|
| 86 | - */ |
|
| 87 | - public function delete($id) |
|
| 88 | - { |
|
| 89 | - return new GeneralResource($this->repo->delete($id)); |
|
| 90 | - } |
|
| 91 | - |
|
| 92 | - /** |
|
| 93 | - * Return the deleted models in pages based on the given conditions. |
|
| 94 | - * |
|
| 95 | - * @param Request $request |
|
| 96 | - * @return \Illuminate\Http\Response |
|
| 97 | - */ |
|
| 98 | - public function deleted(Request $request) |
|
| 99 | - { |
|
| 100 | - return $this->modelResource::collection($this->repo->deleted($request->all(), $request->query('perPage'), $request->query('sortBy'), $request->query('desc'))); |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - /** |
|
| 104 | - * Restore the deleted model. |
|
| 105 | - * |
|
| 106 | - * @param integer $id Id of the restored model. |
|
| 107 | - * @return \Illuminate\Http\Response |
|
| 108 | - */ |
|
| 109 | - public function restore($id) |
|
| 110 | - { |
|
| 111 | - return new GeneralResource($this->repo->restore($id)); |
|
| 112 | - } |
|
| 113 | - |
|
| 114 | - /** |
|
| 115 | - * Check if the logged in user can do the given permission. |
|
| 116 | - * |
|
| 117 | - * @param string $permission |
|
| 118 | - * @return void |
|
| 119 | - */ |
|
| 120 | - private function checkPermission($permission) |
|
| 121 | - { |
|
| 122 | - \Auth::shouldUse('api'); |
|
| 123 | - $this->middleware('auth:api', ['except' => $this->skipLoginCheck]); |
|
| 13 | + /** |
|
| 14 | + * The config implementation. |
|
| 15 | + * |
|
| 16 | + * @var array |
|
| 17 | + */ |
|
| 18 | + protected $config; |
|
| 19 | + |
|
| 20 | + /** |
|
| 21 | + * The relations implementation. |
|
| 22 | + * |
|
| 23 | + * @var array |
|
| 24 | + */ |
|
| 25 | + protected $relations; |
|
| 26 | + |
|
| 27 | + /** |
|
| 28 | + * The repo implementation. |
|
| 29 | + * |
|
| 30 | + * @var object |
|
| 31 | + */ |
|
| 32 | + protected $repo; |
|
| 33 | + |
|
| 34 | + /** |
|
| 35 | + * Init new object. |
|
| 36 | + * |
|
| 37 | + * @param mixed $repo |
|
| 38 | + * @param CoreConfig $config |
|
| 39 | + * @param string $modelResource |
|
| 40 | + * @return void |
|
| 41 | + */ |
|
| 42 | + public function __construct($repo, $config, $modelResource) |
|
| 43 | + { |
|
| 44 | + $this->repo = new CachingDecorator($repo, \App::make('Illuminate\Contracts\Cache\Repository')); |
|
| 45 | + $this->modelResource = $modelResource; |
|
| 46 | + $this->config = $config->getConfig(); |
|
| 47 | + $this->modelName = explode('\\', get_called_class()); |
|
| 48 | + $this->modelName = lcfirst(str_replace('Controller', '', end($this->modelName))); |
|
| 49 | + $this->validationRules = property_exists($this, 'validationRules') ? $this->validationRules : false; |
|
| 50 | + $this->skipPermissionCheck = property_exists($this, 'skipPermissionCheck') ? $this->skipPermissionCheck : []; |
|
| 51 | + $this->skipLoginCheck = property_exists($this, 'skipLoginCheck') ? $this->skipLoginCheck : []; |
|
| 52 | + $route = explode('@', \Route::currentRouteAction())[1]; |
|
| 53 | + |
|
| 54 | + $this->setSessions(); |
|
| 55 | + $this->checkPermission($route); |
|
| 56 | + $this->setRelations($route); |
|
| 57 | + } |
|
| 58 | + |
|
| 59 | + /** |
|
| 60 | + * Fetch all records with relations from storage. |
|
| 61 | + * |
|
| 62 | + * @param Request $request |
|
| 63 | + * @return \Illuminate\Http\Response |
|
| 64 | + */ |
|
| 65 | + public function index(Request $request) |
|
| 66 | + { |
|
| 67 | + return $this->modelResource::collection($this->repo->list($this->relations, $request->query(), $request->query('perPage'), $request->query('sortBy'), $request->query('desc'))); |
|
| 68 | + } |
|
| 69 | + |
|
| 70 | + /** |
|
| 71 | + * Fetch the single object with relations from storage. |
|
| 72 | + * |
|
| 73 | + * @param integer $id Id of the requested model. |
|
| 74 | + * @return \Illuminate\Http\Response |
|
| 75 | + */ |
|
| 76 | + public function find($id) |
|
| 77 | + { |
|
| 78 | + return new $this->modelResource($this->repo->find($id, $this->relations)); |
|
| 79 | + } |
|
| 80 | + |
|
| 81 | + /** |
|
| 82 | + * Delete by the given id from storage. |
|
| 83 | + * |
|
| 84 | + * @param integer $id Id of the deleted model. |
|
| 85 | + * @return \Illuminate\Http\Response |
|
| 86 | + */ |
|
| 87 | + public function delete($id) |
|
| 88 | + { |
|
| 89 | + return new GeneralResource($this->repo->delete($id)); |
|
| 90 | + } |
|
| 91 | + |
|
| 92 | + /** |
|
| 93 | + * Return the deleted models in pages based on the given conditions. |
|
| 94 | + * |
|
| 95 | + * @param Request $request |
|
| 96 | + * @return \Illuminate\Http\Response |
|
| 97 | + */ |
|
| 98 | + public function deleted(Request $request) |
|
| 99 | + { |
|
| 100 | + return $this->modelResource::collection($this->repo->deleted($request->all(), $request->query('perPage'), $request->query('sortBy'), $request->query('desc'))); |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + /** |
|
| 104 | + * Restore the deleted model. |
|
| 105 | + * |
|
| 106 | + * @param integer $id Id of the restored model. |
|
| 107 | + * @return \Illuminate\Http\Response |
|
| 108 | + */ |
|
| 109 | + public function restore($id) |
|
| 110 | + { |
|
| 111 | + return new GeneralResource($this->repo->restore($id)); |
|
| 112 | + } |
|
| 113 | + |
|
| 114 | + /** |
|
| 115 | + * Check if the logged in user can do the given permission. |
|
| 116 | + * |
|
| 117 | + * @param string $permission |
|
| 118 | + * @return void |
|
| 119 | + */ |
|
| 120 | + private function checkPermission($permission) |
|
| 121 | + { |
|
| 122 | + \Auth::shouldUse('api'); |
|
| 123 | + $this->middleware('auth:api', ['except' => $this->skipLoginCheck]); |
|
| 124 | 124 | |
| 125 | - if (! in_array($permission, $this->skipLoginCheck) && $user = \Auth::user()) { |
|
| 126 | - $user = \Auth::user(); |
|
| 127 | - $isPasswordClient = $user->token()->client->password_client; |
|
| 128 | - $this->updateLocaleAndTimezone($user); |
|
| 129 | - |
|
| 130 | - if ($user->blocked) { |
|
| 131 | - \ErrorHandler::userIsBlocked(); |
|
| 132 | - } |
|
| 133 | - |
|
| 134 | - if ($isPasswordClient && (in_array($permission, $this->skipPermissionCheck) || \Core::users()->can($permission, $this->modelName))) { |
|
| 135 | - } elseif (! $isPasswordClient && $user->tokenCan($this->modelName.'-'.$permission)) { |
|
| 136 | - } else { |
|
| 137 | - \ErrorHandler::noPermissions(); |
|
| 138 | - } |
|
| 139 | - } |
|
| 140 | - } |
|
| 141 | - |
|
| 142 | - /** |
|
| 143 | - * Set sessions based on the given headers in the request. |
|
| 144 | - * |
|
| 145 | - * @return void |
|
| 146 | - */ |
|
| 147 | - private function setSessions() |
|
| 148 | - { |
|
| 149 | - \Session::put('time-zone', \Request::header('time-zone') ?: 0); |
|
| 150 | - |
|
| 151 | - $locale = \Request::header('locale'); |
|
| 152 | - switch ($locale) { |
|
| 153 | - case 'en': |
|
| 154 | - \App::setLocale('en'); |
|
| 155 | - \Session::put('locale', 'en'); |
|
| 156 | - break; |
|
| 157 | - |
|
| 158 | - case 'ar': |
|
| 159 | - \App::setLocale('ar'); |
|
| 160 | - \Session::put('locale', 'ar'); |
|
| 161 | - break; |
|
| 162 | - |
|
| 163 | - case 'all': |
|
| 164 | - \App::setLocale('en'); |
|
| 165 | - \Session::put('locale', 'all'); |
|
| 166 | - break; |
|
| 167 | - |
|
| 168 | - default: |
|
| 169 | - \App::setLocale('en'); |
|
| 170 | - \Session::put('locale', 'en'); |
|
| 171 | - break; |
|
| 172 | - } |
|
| 173 | - } |
|
| 174 | - |
|
| 175 | - /** |
|
| 176 | - * Set relation based on the called api. |
|
| 177 | - * |
|
| 178 | - * @param string $route |
|
| 179 | - * @return void |
|
| 180 | - */ |
|
| 181 | - private function setRelations($route) |
|
| 182 | - { |
|
| 183 | - $route = $route !== 'index' ? $route : 'list'; |
|
| 184 | - $relations = Arr::get($this->config['relations'], $this->modelName, false); |
|
| 185 | - $this->relations = $relations && isset($relations[$route]) ? $relations[$route] : []; |
|
| 186 | - } |
|
| 187 | - |
|
| 188 | - /** |
|
| 189 | - * Update the logged in user locale and time zone. |
|
| 190 | - * |
|
| 191 | - * @param object $user |
|
| 192 | - * @return void |
|
| 193 | - */ |
|
| 194 | - private function updateLocaleAndTimezone($user) |
|
| 195 | - { |
|
| 196 | - $update = false; |
|
| 197 | - $locale = \Session::get('locale'); |
|
| 198 | - $timezone = \Session::get('time-zone'); |
|
| 199 | - if ($locale && $locale !== 'all' && $locale !== $user->locale) { |
|
| 200 | - $user->locale = $locale; |
|
| 201 | - $update = true; |
|
| 202 | - } |
|
| 203 | - |
|
| 204 | - if ($timezone && $timezone !== $user->timezone) { |
|
| 205 | - $user->timezone = $timezone; |
|
| 206 | - $update = true; |
|
| 207 | - } |
|
| 208 | - |
|
| 209 | - if ($update) { |
|
| 210 | - $user->save(); |
|
| 211 | - } |
|
| 212 | - } |
|
| 125 | + if (! in_array($permission, $this->skipLoginCheck) && $user = \Auth::user()) { |
|
| 126 | + $user = \Auth::user(); |
|
| 127 | + $isPasswordClient = $user->token()->client->password_client; |
|
| 128 | + $this->updateLocaleAndTimezone($user); |
|
| 129 | + |
|
| 130 | + if ($user->blocked) { |
|
| 131 | + \ErrorHandler::userIsBlocked(); |
|
| 132 | + } |
|
| 133 | + |
|
| 134 | + if ($isPasswordClient && (in_array($permission, $this->skipPermissionCheck) || \Core::users()->can($permission, $this->modelName))) { |
|
| 135 | + } elseif (! $isPasswordClient && $user->tokenCan($this->modelName.'-'.$permission)) { |
|
| 136 | + } else { |
|
| 137 | + \ErrorHandler::noPermissions(); |
|
| 138 | + } |
|
| 139 | + } |
|
| 140 | + } |
|
| 141 | + |
|
| 142 | + /** |
|
| 143 | + * Set sessions based on the given headers in the request. |
|
| 144 | + * |
|
| 145 | + * @return void |
|
| 146 | + */ |
|
| 147 | + private function setSessions() |
|
| 148 | + { |
|
| 149 | + \Session::put('time-zone', \Request::header('time-zone') ?: 0); |
|
| 150 | + |
|
| 151 | + $locale = \Request::header('locale'); |
|
| 152 | + switch ($locale) { |
|
| 153 | + case 'en': |
|
| 154 | + \App::setLocale('en'); |
|
| 155 | + \Session::put('locale', 'en'); |
|
| 156 | + break; |
|
| 157 | + |
|
| 158 | + case 'ar': |
|
| 159 | + \App::setLocale('ar'); |
|
| 160 | + \Session::put('locale', 'ar'); |
|
| 161 | + break; |
|
| 162 | + |
|
| 163 | + case 'all': |
|
| 164 | + \App::setLocale('en'); |
|
| 165 | + \Session::put('locale', 'all'); |
|
| 166 | + break; |
|
| 167 | + |
|
| 168 | + default: |
|
| 169 | + \App::setLocale('en'); |
|
| 170 | + \Session::put('locale', 'en'); |
|
| 171 | + break; |
|
| 172 | + } |
|
| 173 | + } |
|
| 174 | + |
|
| 175 | + /** |
|
| 176 | + * Set relation based on the called api. |
|
| 177 | + * |
|
| 178 | + * @param string $route |
|
| 179 | + * @return void |
|
| 180 | + */ |
|
| 181 | + private function setRelations($route) |
|
| 182 | + { |
|
| 183 | + $route = $route !== 'index' ? $route : 'list'; |
|
| 184 | + $relations = Arr::get($this->config['relations'], $this->modelName, false); |
|
| 185 | + $this->relations = $relations && isset($relations[$route]) ? $relations[$route] : []; |
|
| 186 | + } |
|
| 187 | + |
|
| 188 | + /** |
|
| 189 | + * Update the logged in user locale and time zone. |
|
| 190 | + * |
|
| 191 | + * @param object $user |
|
| 192 | + * @return void |
|
| 193 | + */ |
|
| 194 | + private function updateLocaleAndTimezone($user) |
|
| 195 | + { |
|
| 196 | + $update = false; |
|
| 197 | + $locale = \Session::get('locale'); |
|
| 198 | + $timezone = \Session::get('time-zone'); |
|
| 199 | + if ($locale && $locale !== 'all' && $locale !== $user->locale) { |
|
| 200 | + $user->locale = $locale; |
|
| 201 | + $update = true; |
|
| 202 | + } |
|
| 203 | + |
|
| 204 | + if ($timezone && $timezone !== $user->timezone) { |
|
| 205 | + $user->timezone = $timezone; |
|
| 206 | + $update = true; |
|
| 207 | + } |
|
| 208 | + |
|
| 209 | + if ($update) { |
|
| 210 | + $user->save(); |
|
| 211 | + } |
|
| 212 | + } |
|
| 213 | 213 | } |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | \Auth::shouldUse('api'); |
| 123 | 123 | $this->middleware('auth:api', ['except' => $this->skipLoginCheck]); |
| 124 | 124 | |
| 125 | - if (! in_array($permission, $this->skipLoginCheck) && $user = \Auth::user()) { |
|
| 125 | + if ( ! in_array($permission, $this->skipLoginCheck) && $user = \Auth::user()) { |
|
| 126 | 126 | $user = \Auth::user(); |
| 127 | 127 | $isPasswordClient = $user->token()->client->password_client; |
| 128 | 128 | $this->updateLocaleAndTimezone($user); |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if ($isPasswordClient && (in_array($permission, $this->skipPermissionCheck) || \Core::users()->can($permission, $this->modelName))) { |
| 135 | - } elseif (! $isPasswordClient && $user->tokenCan($this->modelName.'-'.$permission)) { |
|
| 135 | + } elseif ( ! $isPasswordClient && $user->tokenCan($this->modelName.'-'.$permission)) { |
|
| 136 | 136 | } else { |
| 137 | 137 | \ErrorHandler::noPermissions(); |
| 138 | 138 | } |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | |
| 204 | 204 | if ($timezone && $timezone !== $user->timezone) { |
| 205 | 205 | $user->timezone = $timezone; |
| 206 | - $update = true; |
|
| 206 | + $update = true; |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | if ($update) { |
@@ -6,32 +6,32 @@ |
||
| 6 | 6 | |
| 7 | 7 | class Setting extends JsonResource |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * Indicates if the resource's collection keys should be preserved. |
|
| 11 | - * |
|
| 12 | - * @var bool |
|
| 13 | - */ |
|
| 14 | - public $preserveKeys = true; |
|
| 9 | + /** |
|
| 10 | + * Indicates if the resource's collection keys should be preserved. |
|
| 11 | + * |
|
| 12 | + * @var bool |
|
| 13 | + */ |
|
| 14 | + public $preserveKeys = true; |
|
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * Transform the resource into an array. |
|
| 18 | - * |
|
| 19 | - * @param Request $request |
|
| 20 | - * @return array |
|
| 21 | - */ |
|
| 22 | - public function toArray($request) |
|
| 23 | - { |
|
| 24 | - if (! $this->resource) { |
|
| 25 | - return []; |
|
| 26 | - } |
|
| 16 | + /** |
|
| 17 | + * Transform the resource into an array. |
|
| 18 | + * |
|
| 19 | + * @param Request $request |
|
| 20 | + * @return array |
|
| 21 | + */ |
|
| 22 | + public function toArray($request) |
|
| 23 | + { |
|
| 24 | + if (! $this->resource) { |
|
| 25 | + return []; |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | - return [ |
|
| 29 | - 'id' => $this->id, |
|
| 30 | - 'name' => $this->name, |
|
| 31 | - 'value' => $this->value, |
|
| 32 | - 'key' => $this->key, |
|
| 33 | - 'created_at' => $this->created_at, |
|
| 34 | - 'updated_at' => $this->updated_at, |
|
| 35 | - ]; |
|
| 36 | - } |
|
| 28 | + return [ |
|
| 29 | + 'id' => $this->id, |
|
| 30 | + 'name' => $this->name, |
|
| 31 | + 'value' => $this->value, |
|
| 32 | + 'key' => $this->key, |
|
| 33 | + 'created_at' => $this->created_at, |
|
| 34 | + 'updated_at' => $this->updated_at, |
|
| 35 | + ]; |
|
| 36 | + } |
|
| 37 | 37 | } |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | public function toArray($request) |
| 23 | 23 | { |
| 24 | - if (! $this->resource) { |
|
| 24 | + if ( ! $this->resource) { |
|
| 25 | 25 | return []; |
| 26 | 26 | } |
| 27 | 27 | |
@@ -13,12 +13,12 @@ |
||
| 13 | 13 | |
| 14 | 14 | Route::group(['prefix' => 'reports'], function () { |
| 15 | 15 | |
| 16 | - Route::get('/', 'ReportController@index'); |
|
| 17 | - Route::get('/{id}', 'ReportController@find'); |
|
| 18 | - Route::post('/', 'ReportController@insert'); |
|
| 19 | - Route::put('/', 'ReportController@update'); |
|
| 20 | - Route::delete('/{id}', 'ReportController@delete'); |
|
| 21 | - Route::get('list/deleted', 'ReportController@deleted'); |
|
| 22 | - Route::patch('restore/{id}', 'ReportController@restore'); |
|
| 23 | - Route::post('get/{reportName}', 'ReportController@getReport'); |
|
| 16 | + Route::get('/', 'ReportController@index'); |
|
| 17 | + Route::get('/{id}', 'ReportController@find'); |
|
| 18 | + Route::post('/', 'ReportController@insert'); |
|
| 19 | + Route::put('/', 'ReportController@update'); |
|
| 20 | + Route::delete('/{id}', 'ReportController@delete'); |
|
| 21 | + Route::get('list/deleted', 'ReportController@deleted'); |
|
| 22 | + Route::patch('restore/{id}', 'ReportController@restore'); |
|
| 23 | + Route::post('get/{reportName}', 'ReportController@getReport'); |
|
| 24 | 24 | }); |
| 25 | 25 | \ No newline at end of file |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | | |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | -Route::group(['prefix' => 'reports'], function () { |
|
| 14 | +Route::group(['prefix' => 'reports'], function() { |
|
| 15 | 15 | |
| 16 | 16 | Route::get('/', 'ReportController@index'); |
| 17 | 17 | Route::get('/{id}', 'ReportController@find'); |
@@ -6,27 +6,27 @@ |
||
| 6 | 6 | |
| 7 | 7 | class ModuleServiceProvider extends ServiceProvider |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * Bootstrap the module services. |
|
| 11 | - * |
|
| 12 | - * @return void |
|
| 13 | - */ |
|
| 14 | - public function boot() |
|
| 15 | - { |
|
| 16 | - $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'reporting'); |
|
| 17 | - $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'reporting'); |
|
| 9 | + /** |
|
| 10 | + * Bootstrap the module services. |
|
| 11 | + * |
|
| 12 | + * @return void |
|
| 13 | + */ |
|
| 14 | + public function boot() |
|
| 15 | + { |
|
| 16 | + $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'reporting'); |
|
| 17 | + $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'reporting'); |
|
| 18 | 18 | |
| 19 | - $this->loadMigrationsFrom(module_path('reporting', 'Database/Migrations', 'app')); |
|
| 20 | - $this->loadFactoriesFrom(module_path('reporting', 'Database/Factories', 'app')); |
|
| 21 | - } |
|
| 19 | + $this->loadMigrationsFrom(module_path('reporting', 'Database/Migrations', 'app')); |
|
| 20 | + $this->loadFactoriesFrom(module_path('reporting', 'Database/Factories', 'app')); |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * Register the module services. |
|
| 25 | - * |
|
| 26 | - * @return void |
|
| 27 | - */ |
|
| 28 | - public function register() |
|
| 29 | - { |
|
| 30 | - $this->app->register(RouteServiceProvider::class); |
|
| 31 | - } |
|
| 23 | + /** |
|
| 24 | + * Register the module services. |
|
| 25 | + * |
|
| 26 | + * @return void |
|
| 27 | + */ |
|
| 28 | + public function register() |
|
| 29 | + { |
|
| 30 | + $this->app->register(RouteServiceProvider::class); |
|
| 31 | + } |
|
| 32 | 32 | } |