Completed
Push — master ( 8df45b...9d0042 )
by Sherif
02:28 queued 11s
created
src/Modules/Core/Decorators/CachingDecorator.php 1 patch
Indentation   +100 added lines, -100 removed lines patch added patch discarded remove patch
@@ -5,116 +5,116 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/Modules/Core/Http/Resources/Setting.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -6,32 +6,32 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/Modules/Reporting/Providers/ModuleServiceProvider.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -6,27 +6,27 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/Modules/Reporting/Http/Resources/Report.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -6,24 +6,24 @@
 block discarded – undo
6 6
 
7 7
 class Report extends JsonResource
8 8
 {
9
-    /**
10
-     * Transform the resource into an array.
11
-     *
12
-     * @param Request $request
13
-     * @return array
14
-     */
15
-    public function toArray($request)
16
-    {
17
-        if (! $this->resource) {
18
-            return [];
19
-        }
9
+	/**
10
+	 * Transform the resource into an array.
11
+	 *
12
+	 * @param Request $request
13
+	 * @return array
14
+	 */
15
+	public function toArray($request)
16
+	{
17
+		if (! $this->resource) {
18
+			return [];
19
+		}
20 20
 
21
-        return [
22
-            'id' => $this->id,
23
-            'report_name' => $this->report_name,
24
-            'view_name' => $this->view_name,
25
-            'created_at' => $this->created_at,
26
-            'updated_at' => $this->updated_at,
27
-        ];
28
-    }
21
+		return [
22
+			'id' => $this->id,
23
+			'report_name' => $this->report_name,
24
+			'view_name' => $this->view_name,
25
+			'created_at' => $this->created_at,
26
+			'updated_at' => $this->updated_at,
27
+		];
28
+	}
29 29
 }
Please login to merge, or discard this patch.
src/Modules/Groups/Repositories/GroupRepository.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -5,32 +5,32 @@
 block discarded – undo
5 5
 
6 6
 class GroupRepository extends BaseRepository
7 7
 {
8
-    /**
9
-     * Init new object.
10
-     *
11
-     * @param   AclGroup $model
12
-     * @return  void
13
-     */
14
-    public function __construct(AclGroup $model)
15
-    {
16
-        parent::__construct($model);
17
-    }
8
+	/**
9
+	 * Init new object.
10
+	 *
11
+	 * @param   AclGroup $model
12
+	 * @return  void
13
+	 */
14
+	public function __construct(AclGroup $model)
15
+	{
16
+		parent::__construct($model);
17
+	}
18 18
 
19
-    /**
20
-     * Assign the given permission ids to the given group.
21
-     *
22
-     * @param  integer $groupId
23
-     * @param  array   $permissionIds
24
-     * @return object
25
-     */
26
-    public function assignPermissions($groupId, $permissionIds)
27
-    {
28
-        \DB::transaction(function () use ($groupId, $permissionIds) {
29
-            $group = $this->find($groupId);
30
-            $group->permissions()->detach();
31
-            $group->permissions()->attach($permissionIds);
32
-        });
19
+	/**
20
+	 * Assign the given permission ids to the given group.
21
+	 *
22
+	 * @param  integer $groupId
23
+	 * @param  array   $permissionIds
24
+	 * @return object
25
+	 */
26
+	public function assignPermissions($groupId, $permissionIds)
27
+	{
28
+		\DB::transaction(function () use ($groupId, $permissionIds) {
29
+			$group = $this->find($groupId);
30
+			$group->permissions()->detach();
31
+			$group->permissions()->attach($permissionIds);
32
+		});
33 33
 
34
-        return $this->find($groupId);
35
-    }
34
+		return $this->find($groupId);
35
+	}
36 36
 }
Please login to merge, or discard this patch.
src/Modules/Groups/ModelObservers/AclGroupObserver.php 1 patch
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -6,69 +6,69 @@
 block discarded – undo
6 6
 class AclGroupObserver
7 7
 {
8 8
 
9
-    public function saving($model)
10
-    {
11
-        //
12
-    }
9
+	public function saving($model)
10
+	{
11
+		//
12
+	}
13 13
 
14
-    public function saved($model)
15
-    {
16
-        //
17
-    }
14
+	public function saved($model)
15
+	{
16
+		//
17
+	}
18 18
 
19
-    public function creating($model)
20
-    {
21
-        //
22
-    }
19
+	public function creating($model)
20
+	{
21
+		//
22
+	}
23 23
 
24
-    public function created($model)
25
-    {
26
-        //
27
-    }
24
+	public function created($model)
25
+	{
26
+		//
27
+	}
28 28
 
29
-    /**
30
-     * Prevent updating of the admin group.
31
-     *
32
-     * @param  object $model the model beign updated.
33
-     * @return void
34
-     */
35
-    public function updating($model)
36
-    {
37
-        if ($model->getOriginal('name') == 'Admin') {
38
-            \ErrorHandler::noPermissions();
39
-        }
40
-    }
29
+	/**
30
+	 * Prevent updating of the admin group.
31
+	 *
32
+	 * @param  object $model the model beign updated.
33
+	 * @return void
34
+	 */
35
+	public function updating($model)
36
+	{
37
+		if ($model->getOriginal('name') == 'Admin') {
38
+			\ErrorHandler::noPermissions();
39
+		}
40
+	}
41 41
 
42
-    public function updated($model)
43
-    {
44
-        //
45
-    }
42
+	public function updated($model)
43
+	{
44
+		//
45
+	}
46 46
 
47
-    /**
48
-     * Prevent deleting the admin group.
49
-     *
50
-     * @param  object $model the delted model.
51
-     * @return void
52
-     */
53
-    public function deleting($model)
54
-    {
55
-        if ($model->getOriginal('name') == 'Admin') {
56
-            \ErrorHandler::noPermissions();
57
-        }
58
-    }
47
+	/**
48
+	 * Prevent deleting the admin group.
49
+	 *
50
+	 * @param  object $model the delted model.
51
+	 * @return void
52
+	 */
53
+	public function deleting($model)
54
+	{
55
+		if ($model->getOriginal('name') == 'Admin') {
56
+			\ErrorHandler::noPermissions();
57
+		}
58
+	}
59 59
 
60
-    public function deleted($model)
61
-    {
62
-        //
63
-    }
60
+	public function deleted($model)
61
+	{
62
+		//
63
+	}
64 64
 
65
-    public function restoring($model)
66
-    {
67
-        //
68
-    }
65
+	public function restoring($model)
66
+	{
67
+		//
68
+	}
69 69
 
70
-    public function restored($model)
71
-    {
72
-        //
73
-    }
70
+	public function restored($model)
71
+	{
72
+		//
73
+	}
74 74
 }
Please login to merge, or discard this patch.
src/Modules/Groups/Providers/ModuleServiceProvider.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -6,27 +6,27 @@
 block discarded – undo
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', 'groups');
17
-        $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'groups');
9
+	/**
10
+	 * Bootstrap the module services.
11
+	 *
12
+	 * @return void
13
+	 */
14
+	public function boot()
15
+	{
16
+		$this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'groups');
17
+		$this->loadViewsFrom(__DIR__.'/../Resources/Views', 'groups');
18 18
 
19
-        $this->loadMigrationsFrom(module_path('groups', 'Database/Migrations', 'app'));
20
-        $this->loadFactoriesFrom(module_path('groups', 'Database/Factories', 'app'));
21
-    }
19
+		$this->loadMigrationsFrom(module_path('groups', 'Database/Migrations', 'app'));
20
+		$this->loadFactoriesFrom(module_path('groups', '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
 }
Please login to merge, or discard this patch.
src/Modules/Groups/Providers/RouteServiceProvider.php 1 patch
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -7,73 +7,73 @@
 block discarded – undo
7 7
 
8 8
 class RouteServiceProvider extends ServiceProvider
9 9
 {
10
-    /**
11
-     * This namespace is applied to your controller routes.
12
-     *
13
-     * In addition, it is set as the URL generator's root namespace.
14
-     *
15
-     * @var string
16
-     */
17
-    protected $namespace = 'App\Modules\Groups\Http\Controllers';
10
+	/**
11
+	 * This namespace is applied to your controller routes.
12
+	 *
13
+	 * In addition, it is set as the URL generator's root namespace.
14
+	 *
15
+	 * @var string
16
+	 */
17
+	protected $namespace = 'App\Modules\Groups\Http\Controllers';
18 18
 
19
-    /**
20
-     * Define your route model bindings, pattern filters, etc.
21
-     *
22
-     * @return void
23
-     */
24
-    public function boot()
25
-    {
26
-        //
19
+	/**
20
+	 * Define your route model bindings, pattern filters, etc.
21
+	 *
22
+	 * @return void
23
+	 */
24
+	public function boot()
25
+	{
26
+		//
27 27
 
28
-        parent::boot();
29
-    }
28
+		parent::boot();
29
+	}
30 30
 
31
-    /**
32
-     * Define the routes for the module.
33
-     *
34
-     * @return void
35
-     */
36
-    public function map()
37
-    {
38
-        $this->mapWebRoutes();
31
+	/**
32
+	 * Define the routes for the module.
33
+	 *
34
+	 * @return void
35
+	 */
36
+	public function map()
37
+	{
38
+		$this->mapWebRoutes();
39 39
 
40
-        $this->mapApiRoutes();
40
+		$this->mapApiRoutes();
41 41
 
42
-        //
43
-    }
42
+		//
43
+	}
44 44
 
45
-    /**
46
-     * Define the "web" routes for the module.
47
-     *
48
-     * These routes all receive session state, CSRF protection, etc.
49
-     *
50
-     * @return void
51
-     */
52
-    protected function mapWebRoutes()
53
-    {
54
-        Route::group([
55
-            'middleware' => 'web',
56
-            'namespace'  => $this->namespace,
57
-        ], function ($router) {
58
-            require module_path('groups', 'Routes/web.php', 'app');
59
-        });
60
-    }
45
+	/**
46
+	 * Define the "web" routes for the module.
47
+	 *
48
+	 * These routes all receive session state, CSRF protection, etc.
49
+	 *
50
+	 * @return void
51
+	 */
52
+	protected function mapWebRoutes()
53
+	{
54
+		Route::group([
55
+			'middleware' => 'web',
56
+			'namespace'  => $this->namespace,
57
+		], function ($router) {
58
+			require module_path('groups', 'Routes/web.php', 'app');
59
+		});
60
+	}
61 61
 
62
-    /**
63
-     * Define the "api" routes for the module.
64
-     *
65
-     * These routes are typically stateless.
66
-     *
67
-     * @return void
68
-     */
69
-    protected function mapApiRoutes()
70
-    {
71
-        Route::group([
72
-            'middleware' => 'api',
73
-            'namespace'  => $this->namespace,
74
-            'prefix'     => 'api',
75
-        ], function ($router) {
76
-            require module_path('groups', 'Routes/api.php', 'app');
77
-        });
78
-    }
62
+	/**
63
+	 * Define the "api" routes for the module.
64
+	 *
65
+	 * These routes are typically stateless.
66
+	 *
67
+	 * @return void
68
+	 */
69
+	protected function mapApiRoutes()
70
+	{
71
+		Route::group([
72
+			'middleware' => 'api',
73
+			'namespace'  => $this->namespace,
74
+			'prefix'     => 'api',
75
+		], function ($router) {
76
+			require module_path('groups', 'Routes/api.php', 'app');
77
+		});
78
+	}
79 79
 }
Please login to merge, or discard this patch.
src/Modules/Groups/Database/Factories/GroupFactory.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 $factory->define(App\Modules\Groups\AclGroup::class, function (Faker\Generator $faker) {
4
-    return [
5
-        'name'       => $faker->unique->word(),
6
-        'created_at' => $faker->dateTimeBetween('-1 years', 'now'),
7
-        'updated_at' => $faker->dateTimeBetween('-1 years', 'now')
8
-    ];
4
+	return [
5
+		'name'       => $faker->unique->word(),
6
+		'created_at' => $faker->dateTimeBetween('-1 years', 'now'),
7
+		'updated_at' => $faker->dateTimeBetween('-1 years', 'now')
8
+	];
9 9
 });
Please login to merge, or discard this patch.