Completed
Push — master ( 9d0042...b45468 )
by Sherif
03:21 queued 01:24
created
src/Modules/Core/Facades/ApiConsumer.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 
5 5
 class ApiConsumer extends Facade
6 6
 {
7
-    protected static function getFacadeAccessor()
8
-    {
9
-        return 'ApiConsumer';
10
-    }
7
+	protected static function getFacadeAccessor()
8
+	{
9
+		return 'ApiConsumer';
10
+	}
11 11
 }
Please login to merge, or discard this patch.
src/Modules/Core/Console/Commands/GenerateDoc.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
      */
80 80
     protected function getRoutes()
81 81
     {
82
-        return collect(\Route::getRoutes())->map(function ($route) {
82
+        return collect(\Route::getRoutes())->map(function($route) {
83 83
             if (strpos($route->uri(), 'api/') !== false) {
84 84
                 return [
85 85
                     'method' => $route->methods()[0],
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         ];
111 111
 
112 112
 
113
-        if (! $skipLoginCheck || ! in_array($method, $skipLoginCheck)) {
113
+        if ( ! $skipLoginCheck || ! in_array($method, $skipLoginCheck)) {
114 114
             $route['headers']['Authorization'] = 'Bearer {token}';
115 115
         }
116 116
     }
Please login to merge, or discard this patch.
Indentation   +223 added lines, -223 removed lines patch added patch discarded remove patch
@@ -7,255 +7,255 @@
 block discarded – undo
7 7
 
8 8
 class GenerateDoc extends Command
9 9
 {
10
-    /**
11
-     * The name and signature of the console command.
12
-     *
13
-     * @var string
14
-     */
15
-    protected $signature = 'doc:generate';
10
+	/**
11
+	 * The name and signature of the console command.
12
+	 *
13
+	 * @var string
14
+	 */
15
+	protected $signature = 'doc:generate';
16 16
 
17
-    /**
18
-     * The console command description.
19
-     *
20
-     * @var string
21
-     */
22
-    protected $description = 'Generate api documentation';
17
+	/**
18
+	 * The console command description.
19
+	 *
20
+	 * @var string
21
+	 */
22
+	protected $description = 'Generate api documentation';
23 23
 
24
-    /**
25
-     * Init new object.
26
-     *
27
-     * @return  void
28
-     */
29
-    public function __construct()
30
-    {
31
-        parent::__construct();
32
-    }
24
+	/**
25
+	 * Init new object.
26
+	 *
27
+	 * @return  void
28
+	 */
29
+	public function __construct()
30
+	{
31
+		parent::__construct();
32
+	}
33 33
 
34
-    /**
35
-     * Execute the console command.
36
-     *
37
-     * @return mixed
38
-     */
39
-    public function handle()
40
-    {
41
-        $docData           = [];
42
-        $docData['models'] = [];
43
-        $routes            = $this->getRoutes();
44
-        foreach ($routes as $route) {
45
-            if ($route) {
46
-                $actoinArray = explode('@', $route['action']);
47
-                if (Arr::get($actoinArray, 1, false)) {
48
-                    $controller       = $actoinArray[0];
49
-                    $method           = $actoinArray[1];
50
-                    $route['name']    = $method !== 'index' ? $method : 'list';
34
+	/**
35
+	 * Execute the console command.
36
+	 *
37
+	 * @return mixed
38
+	 */
39
+	public function handle()
40
+	{
41
+		$docData           = [];
42
+		$docData['models'] = [];
43
+		$routes            = $this->getRoutes();
44
+		foreach ($routes as $route) {
45
+			if ($route) {
46
+				$actoinArray = explode('@', $route['action']);
47
+				if (Arr::get($actoinArray, 1, false)) {
48
+					$controller       = $actoinArray[0];
49
+					$method           = $actoinArray[1];
50
+					$route['name']    = $method !== 'index' ? $method : 'list';
51 51
                     
52
-                    $reflectionClass  = new \ReflectionClass($controller);
53
-                    $reflectionMethod = $reflectionClass->getMethod($method);
54
-                    $classProperties  = $reflectionClass->getDefaultProperties();
55
-                    $skipLoginCheck   = Arr::get($classProperties, 'skipLoginCheck', false);
56
-                    $validationRules  = Arr::get($classProperties, 'validationRules', false);
52
+					$reflectionClass  = new \ReflectionClass($controller);
53
+					$reflectionMethod = $reflectionClass->getMethod($method);
54
+					$classProperties  = $reflectionClass->getDefaultProperties();
55
+					$skipLoginCheck   = Arr::get($classProperties, 'skipLoginCheck', false);
56
+					$validationRules  = Arr::get($classProperties, 'validationRules', false);
57 57
 
58
-                    dd($classProperties);
59
-                    $this->processDocBlock($route, $reflectionMethod);
60
-                    $this->getHeaders($route, $method, $skipLoginCheck);
61
-                    $this->getPostData($route, $reflectionMethod, $validationRules);
58
+					dd($classProperties);
59
+					$this->processDocBlock($route, $reflectionMethod);
60
+					$this->getHeaders($route, $method, $skipLoginCheck);
61
+					$this->getPostData($route, $reflectionMethod, $validationRules);
62 62
 
63
-                    $route['response'] = $this->getResponseObject($classProperties['model'], $route['name'], $route['returnDocBlock']);
63
+					$route['response'] = $this->getResponseObject($classProperties['model'], $route['name'], $route['returnDocBlock']);
64 64
 
65
-                    preg_match('/api\/([^#]+)\//iU', $route['uri'], $module);
66
-                    $docData['modules'][$module[1]][substr($route['prefix'], strlen('/api/'.$module[1].'/') - 1)][] = $route;
65
+					preg_match('/api\/([^#]+)\//iU', $route['uri'], $module);
66
+					$docData['modules'][$module[1]][substr($route['prefix'], strlen('/api/'.$module[1].'/') - 1)][] = $route;
67 67
 
68
-                    $this->getModels($classProperties['model'], $docData);
69
-                }
70
-            }
71
-        }
68
+					$this->getModels($classProperties['model'], $docData);
69
+				}
70
+			}
71
+		}
72 72
         
73
-        $docData['errors']  = $this->getErrors();
74
-        $docData['reports'] = \Core::reports()->all();
75
-        \File::put(app_path('Modules/Core/Resources/api.json'), json_encode($docData));
76
-    }
73
+		$docData['errors']  = $this->getErrors();
74
+		$docData['reports'] = \Core::reports()->all();
75
+		\File::put(app_path('Modules/Core/Resources/api.json'), json_encode($docData));
76
+	}
77 77
 
78
-    /**
79
-     * Get list of all registered routes.
80
-     *
81
-     * @return collection
82
-     */
83
-    protected function getRoutes()
84
-    {
85
-        return collect(\Route::getRoutes())->map(function ($route) {
86
-            if (strpos($route->uri(), 'api/') !== false) {
87
-                return [
88
-                    'method' => $route->methods()[0],
89
-                    'uri'    => $route->uri(),
90
-                    'action' => $route->getActionName(),
91
-                    'prefix' => $route->getPrefix()
92
-                ];
93
-            }
94
-            return false;
95
-        })->all();
96
-    }
78
+	/**
79
+	 * Get list of all registered routes.
80
+	 *
81
+	 * @return collection
82
+	 */
83
+	protected function getRoutes()
84
+	{
85
+		return collect(\Route::getRoutes())->map(function ($route) {
86
+			if (strpos($route->uri(), 'api/') !== false) {
87
+				return [
88
+					'method' => $route->methods()[0],
89
+					'uri'    => $route->uri(),
90
+					'action' => $route->getActionName(),
91
+					'prefix' => $route->getPrefix()
92
+				];
93
+			}
94
+			return false;
95
+		})->all();
96
+	}
97 97
 
98
-    /**
99
-     * Generate headers for the given route.
100
-     *
101
-     * @param  array  &$route
102
-     * @param  string $method
103
-     * @param  array  $skipLoginCheck
104
-     * @return void
105
-     */
106
-    protected function getHeaders(&$route, $method, $skipLoginCheck)
107
-    {
108
-        $route['headers'] = [
109
-        'Accept'       => 'application/json',
110
-        'Content-Type' => 'application/json',
111
-        'locale'       => 'The language of the returned data: ar, en or all.',
112
-        'time-zone'    => 'Your locale time zone',
113
-        ];
98
+	/**
99
+	 * Generate headers for the given route.
100
+	 *
101
+	 * @param  array  &$route
102
+	 * @param  string $method
103
+	 * @param  array  $skipLoginCheck
104
+	 * @return void
105
+	 */
106
+	protected function getHeaders(&$route, $method, $skipLoginCheck)
107
+	{
108
+		$route['headers'] = [
109
+		'Accept'       => 'application/json',
110
+		'Content-Type' => 'application/json',
111
+		'locale'       => 'The language of the returned data: ar, en or all.',
112
+		'time-zone'    => 'Your locale time zone',
113
+		];
114 114
 
115 115
 
116
-        if (! $skipLoginCheck || ! in_array($method, $skipLoginCheck)) {
117
-            $route['headers']['Authorization'] = 'Bearer {token}';
118
-        }
119
-    }
116
+		if (! $skipLoginCheck || ! in_array($method, $skipLoginCheck)) {
117
+			$route['headers']['Authorization'] = 'Bearer {token}';
118
+		}
119
+	}
120 120
 
121
-    /**
122
-     * Generate description and params for the given route
123
-     * based on the docblock.
124
-     *
125
-     * @param  array  &$route
126
-     * @param  \ReflectionMethod $reflectionMethod
127
-     * @return void
128
-     */
129
-    protected function processDocBlock(&$route, $reflectionMethod)
130
-    {
131
-        $factory                 = \phpDocumentor\Reflection\DocBlockFactory::createInstance();
132
-        $docblock                = $factory->create($reflectionMethod->getDocComment());
133
-        $route['description']    = trim(preg_replace('/\s+/', ' ', $docblock->getSummary()));
134
-        $params                  = $docblock->getTagsByName('param');
135
-        $route['returnDocBlock'] = $docblock->getTagsByName('return')[0]->getType()->getFqsen()->getName();
136
-        foreach ($params as $param) {
137
-            $name = $param->getVariableName();
138
-            if ($name !== 'request') {
139
-                $route['parametars'][$param->getVariableName()] = $param->getDescription()->render();
140
-            }
141
-        }
142
-    }
121
+	/**
122
+	 * Generate description and params for the given route
123
+	 * based on the docblock.
124
+	 *
125
+	 * @param  array  &$route
126
+	 * @param  \ReflectionMethod $reflectionMethod
127
+	 * @return void
128
+	 */
129
+	protected function processDocBlock(&$route, $reflectionMethod)
130
+	{
131
+		$factory                 = \phpDocumentor\Reflection\DocBlockFactory::createInstance();
132
+		$docblock                = $factory->create($reflectionMethod->getDocComment());
133
+		$route['description']    = trim(preg_replace('/\s+/', ' ', $docblock->getSummary()));
134
+		$params                  = $docblock->getTagsByName('param');
135
+		$route['returnDocBlock'] = $docblock->getTagsByName('return')[0]->getType()->getFqsen()->getName();
136
+		foreach ($params as $param) {
137
+			$name = $param->getVariableName();
138
+			if ($name !== 'request') {
139
+				$route['parametars'][$param->getVariableName()] = $param->getDescription()->render();
140
+			}
141
+		}
142
+	}
143 143
 
144
-    /**
145
-     * Generate post body for the given route.
146
-     *
147
-     * @param  array  &$route
148
-     * @param  \ReflectionMethod $reflectionMethod
149
-     * @param  array  $validationRules
150
-     * @return void
151
-     */
152
-    protected function getPostData(&$route, $reflectionMethod, $validationRules)
153
-    {
154
-        if ($route['method'] == 'POST') {
155
-            $body = $this->getMethodBody($reflectionMethod);
144
+	/**
145
+	 * Generate post body for the given route.
146
+	 *
147
+	 * @param  array  &$route
148
+	 * @param  \ReflectionMethod $reflectionMethod
149
+	 * @param  array  $validationRules
150
+	 * @return void
151
+	 */
152
+	protected function getPostData(&$route, $reflectionMethod, $validationRules)
153
+	{
154
+		if ($route['method'] == 'POST') {
155
+			$body = $this->getMethodBody($reflectionMethod);
156 156
 
157
-            preg_match('/\$this->validate\(\$request,([^#]+)\);/iU', $body, $match);
158
-            if (count($match)) {
159
-                if ($match[1] == '$this->validationRules') {
160
-                    $route['body'] = $validationRules;
161
-                } else {
162
-                    $route['body'] = eval('return '.str_replace(',\'.$request->get(\'id\')', ',{id}\'', $match[1]).';');
163
-                }
157
+			preg_match('/\$this->validate\(\$request,([^#]+)\);/iU', $body, $match);
158
+			if (count($match)) {
159
+				if ($match[1] == '$this->validationRules') {
160
+					$route['body'] = $validationRules;
161
+				} else {
162
+					$route['body'] = eval('return '.str_replace(',\'.$request->get(\'id\')', ',{id}\'', $match[1]).';');
163
+				}
164 164
 
165
-                foreach ($route['body'] as &$rule) {
166
-                    if (strpos($rule, 'unique')) {
167
-                        $rule = substr($rule, 0, strpos($rule, 'unique') + 6);
168
-                    } elseif (strpos($rule, 'exists')) {
169
-                        $rule = substr($rule, 0, strpos($rule, 'exists') - 1);
170
-                    }
171
-                }
172
-            } else {
173
-                $route['body'] = 'conditions';
174
-            }
175
-        }
176
-    }
165
+				foreach ($route['body'] as &$rule) {
166
+					if (strpos($rule, 'unique')) {
167
+						$rule = substr($rule, 0, strpos($rule, 'unique') + 6);
168
+					} elseif (strpos($rule, 'exists')) {
169
+						$rule = substr($rule, 0, strpos($rule, 'exists') - 1);
170
+					}
171
+				}
172
+			} else {
173
+				$route['body'] = 'conditions';
174
+			}
175
+		}
176
+	}
177 177
 
178
-    /**
179
-     * Generate application errors.
180
-     *
181
-     * @return array
182
-     */
183
-    protected function getErrors()
184
-    {
185
-        $errors          = [];
186
-        $reflectionClass = new \ReflectionClass('App\Modules\Core\Utl\ErrorHandler');
187
-        foreach ($reflectionClass->getMethods() as $method) {
188
-            $methodName       = $method->name;
189
-            $reflectionMethod = $reflectionClass->getMethod($methodName);
190
-            $body             = $this->getMethodBody($reflectionMethod);
178
+	/**
179
+	 * Generate application errors.
180
+	 *
181
+	 * @return array
182
+	 */
183
+	protected function getErrors()
184
+	{
185
+		$errors          = [];
186
+		$reflectionClass = new \ReflectionClass('App\Modules\Core\Utl\ErrorHandler');
187
+		foreach ($reflectionClass->getMethods() as $method) {
188
+			$methodName       = $method->name;
189
+			$reflectionMethod = $reflectionClass->getMethod($methodName);
190
+			$body             = $this->getMethodBody($reflectionMethod);
191 191
 
192
-            preg_match('/\$error=\[\'status\'=>([^#]+)\,/iU', $body, $match);
192
+			preg_match('/\$error=\[\'status\'=>([^#]+)\,/iU', $body, $match);
193 193
 
194
-            if (count($match)) {
195
-                $errors[$match[1]][] = $methodName;
196
-            }
197
-        }
194
+			if (count($match)) {
195
+				$errors[$match[1]][] = $methodName;
196
+			}
197
+		}
198 198
 
199
-        return $errors;
200
-    }
199
+		return $errors;
200
+	}
201 201
 
202
-    /**
203
-     * Get the given method body code.
204
-     *
205
-     * @param  \ReflectionMethod $reflectionMethod
206
-     * @return string
207
-     */
208
-    protected function getMethodBody($reflectionMethod)
209
-    {
210
-        $filename   = $reflectionMethod->getFileName();
211
-        $start_line = $reflectionMethod->getStartLine() - 1;
212
-        $end_line   = $reflectionMethod->getEndLine();
213
-        $length     = $end_line - $start_line;
214
-        $source     = file($filename);
215
-        $body       = implode("", array_slice($source, $start_line, $length));
216
-        $body       = trim(preg_replace('/\s+/', '', $body));
202
+	/**
203
+	 * Get the given method body code.
204
+	 *
205
+	 * @param  \ReflectionMethod $reflectionMethod
206
+	 * @return string
207
+	 */
208
+	protected function getMethodBody($reflectionMethod)
209
+	{
210
+		$filename   = $reflectionMethod->getFileName();
211
+		$start_line = $reflectionMethod->getStartLine() - 1;
212
+		$end_line   = $reflectionMethod->getEndLine();
213
+		$length     = $end_line - $start_line;
214
+		$source     = file($filename);
215
+		$body       = implode("", array_slice($source, $start_line, $length));
216
+		$body       = trim(preg_replace('/\s+/', '', $body));
217 217
 
218
-        return $body;
219
-    }
218
+		return $body;
219
+	}
220 220
 
221
-    /**
222
-     * Get example object of all availble models.
223
-     *
224
-     * @param  string $modelName
225
-     * @param  array  $docData
226
-     * @return string
227
-     */
228
-    protected function getModels($modelName, &$docData)
229
-    {
230
-        if ($modelName && ! Arr::has($docData['models'], $modelName)) {
231
-            $modelClass = call_user_func_array("\Core::{$modelName}", [])->modelClass;
232
-            $model      = factory($modelClass)->make();
233
-            $modelArr   = $model->toArray();
221
+	/**
222
+	 * Get example object of all availble models.
223
+	 *
224
+	 * @param  string $modelName
225
+	 * @param  array  $docData
226
+	 * @return string
227
+	 */
228
+	protected function getModels($modelName, &$docData)
229
+	{
230
+		if ($modelName && ! Arr::has($docData['models'], $modelName)) {
231
+			$modelClass = call_user_func_array("\Core::{$modelName}", [])->modelClass;
232
+			$model      = factory($modelClass)->make();
233
+			$modelArr   = $model->toArray();
234 234
 
235
-            if ($model->trans && ! $model->trans->count()) {
236
-                $modelArr['trans'] = [
237
-                    'en' => factory($modelClass.'Translation')->make()->toArray()
238
-                ];
239
-            }
235
+			if ($model->trans && ! $model->trans->count()) {
236
+				$modelArr['trans'] = [
237
+					'en' => factory($modelClass.'Translation')->make()->toArray()
238
+				];
239
+			}
240 240
 
241
-            $docData['models'][$modelName] = json_encode($modelArr, JSON_PRETTY_PRINT);
242
-        }
243
-    }
241
+			$docData['models'][$modelName] = json_encode($modelArr, JSON_PRETTY_PRINT);
242
+		}
243
+	}
244 244
 
245
-    /**
246
-     * Get the route response object type.
247
-     *
248
-     * @param  string $modelName
249
-     * @param  string $method
250
-     * @param  string $returnDocBlock
251
-     * @return array
252
-     */
253
-    protected function getResponseObject($modelName, $method, $returnDocBlock)
254
-    {
255
-        $config    = \CoreConfig::getConfig();
256
-        $relations = Arr::has($config['relations'], $modelName) ? Arr::has($config['relations'][$modelName], $method) ? $config['relations'][$modelName] : false : false;
257
-        $modelName = call_user_func_array("\Core::{$returnDocBlock}", []) ? $returnDocBlock : $modelName;
245
+	/**
246
+	 * Get the route response object type.
247
+	 *
248
+	 * @param  string $modelName
249
+	 * @param  string $method
250
+	 * @param  string $returnDocBlock
251
+	 * @return array
252
+	 */
253
+	protected function getResponseObject($modelName, $method, $returnDocBlock)
254
+	{
255
+		$config    = \CoreConfig::getConfig();
256
+		$relations = Arr::has($config['relations'], $modelName) ? Arr::has($config['relations'][$modelName], $method) ? $config['relations'][$modelName] : false : false;
257
+		$modelName = call_user_func_array("\Core::{$returnDocBlock}", []) ? $returnDocBlock : $modelName;
258 258
 
259
-        return $relations ? [$modelName => $relations && $relations[$method] ? $relations[$method] : []] : false;
260
-    }
259
+		return $relations ? [$modelName => $relations && $relations[$method] ? $relations[$method] : []] : false;
260
+	}
261 261
 }
Please login to merge, or discard this patch.
src/Modules/Core/Utl/CoreConfig.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -2,17 +2,17 @@
 block discarded – undo
2 2
 
3 3
 class CoreConfig
4 4
 {
5
-    public function getConfig()
6
-    {
7
-        return [
8
-            /**
9
-             * Specify what relations should be used for every model.
10
-             */
11
-            'relations' => config('skeleton.relations'),
12
-            /**
13
-             * Specify caching config for each api.
14
-             */
15
-            'cacheConfig' =>  config('skeleton.cache_config'),
16
-        ];
17
-    }
5
+	public function getConfig()
6
+	{
7
+		return [
8
+			/**
9
+			 * Specify what relations should be used for every model.
10
+			 */
11
+			'relations' => config('skeleton.relations'),
12
+			/**
13
+			 * Specify caching config for each api.
14
+			 */
15
+			'cacheConfig' =>  config('skeleton.cache_config'),
16
+		];
17
+	}
18 18
 }
Please login to merge, or discard this patch.
src/Modules/Core/Utl/Media.php 2 patches
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -2,62 +2,62 @@
 block discarded – undo
2 2
 
3 3
 class Media
4 4
 {
5
-    /**
6
-     * Upload the given image.
7
-     *
8
-     * @param  object  $image
9
-     * @param  string  $dir
10
-     * @return string
11
-     */
12
-    public function uploadImage($image, $dir)
13
-    {
14
-        $image = \Image::make($image);
15
-        return $this->saveImage($image, $dir);
16
-    }
5
+	/**
6
+	 * Upload the given image.
7
+	 *
8
+	 * @param  object  $image
9
+	 * @param  string  $dir
10
+	 * @return string
11
+	 */
12
+	public function uploadImage($image, $dir)
13
+	{
14
+		$image = \Image::make($image);
15
+		return $this->saveImage($image, $dir);
16
+	}
17 17
 
18
-    /**
19
-     * Upload the given image.
20
-     *
21
-     * @param  object  $image
22
-     * @param  string  $dir
23
-     * @return string
24
-     */
25
-    public function uploadImageBas64($image, $dir)
26
-    {
27
-        if (! strlen($image)) {
28
-            return null;
29
-        }
18
+	/**
19
+	 * Upload the given image.
20
+	 *
21
+	 * @param  object  $image
22
+	 * @param  string  $dir
23
+	 * @return string
24
+	 */
25
+	public function uploadImageBas64($image, $dir)
26
+	{
27
+		if (! strlen($image)) {
28
+			return null;
29
+		}
30 30
 
31
-        $base  = base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $image));
32
-        $image = \Image::make($base);
31
+		$base  = base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $image));
32
+		$image = \Image::make($base);
33 33
 
34
-        return $this->saveImage($image, $dir);
35
-    }
34
+		return $this->saveImage($image, $dir);
35
+	}
36 36
 
37
-    /**
38
-     * Delete the given image.
39
-     *
40
-     * @param  object $path
41
-     * @return void
42
-     */
43
-    public function deleteImage($path)
44
-    {
45
-        \Storage::delete($path);
46
-    }
37
+	/**
38
+	 * Delete the given image.
39
+	 *
40
+	 * @param  object $path
41
+	 * @return void
42
+	 */
43
+	public function deleteImage($path)
44
+	{
45
+		\Storage::delete($path);
46
+	}
47 47
 
48
-    /**
49
-     * Save the given image.
50
-     *
51
-     * @param  object  $image
52
-     * @param  string  $dir
53
-     * @return string
54
-     */
55
-    protected function saveImage($image, $dir)
56
-    {
57
-        $imageName = 'image'.uniqid().time().'.jpg';
58
-        $path      = 'public'.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR.$imageName;
59
-        \Storage::put($path, $image->stream());
48
+	/**
49
+	 * Save the given image.
50
+	 *
51
+	 * @param  object  $image
52
+	 * @param  string  $dir
53
+	 * @return string
54
+	 */
55
+	protected function saveImage($image, $dir)
56
+	{
57
+		$imageName = 'image'.uniqid().time().'.jpg';
58
+		$path      = 'public'.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR.$imageName;
59
+		\Storage::put($path, $image->stream());
60 60
 
61
-        return $path;
62
-    }
61
+		return $path;
62
+	}
63 63
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
      */
25 25
     public function uploadImageBas64($image, $dir)
26 26
     {
27
-        if (! strlen($image)) {
27
+        if ( ! strlen($image)) {
28 28
             return null;
29 29
         }
30 30
 
Please login to merge, or discard this patch.
src/Modules/Core/Utl/ErrorHandler.php 1 patch
Indentation   +119 added lines, -119 removed lines patch added patch discarded remove patch
@@ -2,123 +2,123 @@
 block discarded – undo
2 2
 
3 3
 class ErrorHandler
4 4
 {
5
-    public function unAuthorized()
6
-    {
7
-        $error = ['status' => 401, 'message' => trans('core::errors.unAuthorized')];
8
-        abort($error['status'], $error['message']);
9
-    }
10
-
11
-    public function invalidRefreshToken()
12
-    {
13
-        $error = ['status' => 400, 'message' => trans('core::errors.invalidRefreshToken')];
14
-        abort($error['status'], $error['message']);
15
-    }
16
-
17
-    public function noPermissions()
18
-    {
19
-        $error = ['status' => 403, 'message' => trans('core::errors.noPermissions')];
20
-        abort($error['status'], $error['message']);
21
-    }
22
-
23
-    public function loginFailed()
24
-    {
25
-        $error = ['status' => 400, 'message' => trans('core::errors.loginFailed')];
26
-        abort($error['status'], $error['message']);
27
-    }
28
-
29
-    public function noSocialEmail()
30
-    {
31
-        $error = ['status' => 400, 'message' => trans('core::errors.noSocialEmail')];
32
-        abort($error['status'], $error['message']);
33
-    }
34
-
35
-    public function userAlreadyRegistered()
36
-    {
37
-        $error = ['status' => 400, 'message' => trans('core::errors.userAlreadyRegistered')];
38
-        abort($error['status'], $error['message']);
39
-    }
40
-
41
-    public function connectionError()
42
-    {
43
-        $error = ['status' => 400, 'message' => trans('core::errors.connectionError')];
44
-        abort($error['status'], $error['message']);
45
-    }
46
-
47
-    public function redisNotRunning()
48
-    {
49
-        $error = ['status' => 400, 'message' => trans('core::errors.redisNotRunning')];
50
-        abort($error['status'], $error['message']);
51
-    }
52
-
53
-    public function dbQueryError()
54
-    {
55
-        $error = ['status' => 400, 'message' => trans('core::errors.dbQueryError')];
56
-        abort($error['status'], $error['message']);
57
-    }
58
-
59
-    public function cannotCreateSetting()
60
-    {
61
-        $error = ['status' => 400, 'message' => trans('core::errors.cannotCreateSetting')];
62
-        abort($error['status'], $error['message']);
63
-    }
64
-
65
-    public function cannotUpdateSettingKey()
66
-    {
67
-        $error = ['status' => 400, 'message' => trans('core::errors.cannotUpdateSettingKey')];
68
-        abort($error['status'], $error['message']);
69
-    }
70
-
71
-    public function userIsBlocked()
72
-    {
73
-        $error = ['status' => 403, 'message' => trans('core::errors.userIsBlocked')];
74
-        abort($error['status'], $error['message']);
75
-    }
76
-
77
-    public function emailNotConfirmed()
78
-    {
79
-        $error = ['status' => 403, 'message' => trans('core::errors.emailNotConfirmed')];
80
-        abort($error['status'], $error['message']);
81
-    }
82
-
83
-    public function emailAlreadyConfirmed()
84
-    {
85
-        $error = ['status' => 403, 'message' => trans('core::errors.emailAlreadyConfirmed')];
86
-        abort($error['status'], $error['message']);
87
-    }
88
-
89
-    public function invalidResetToken()
90
-    {
91
-        $error = ['status' => 400, 'message' => trans('core::errors.invalidResetToken')];
92
-        abort($error['status'], $error['message']);
93
-    }
94
-
95
-    public function invalidResetPassword()
96
-    {
97
-        $error = ['status' => 400, 'message' => trans('core::errors.invalidResetPassword')];
98
-        abort($error['status'], $error['message']);
99
-    }
100
-
101
-    public function invalidOldPassword()
102
-    {
103
-        $error = ['status' => 400, 'message' => trans('core::errors.invalidOldPassword')];
104
-        abort($error['status'], $error['message']);
105
-    }
106
-
107
-    public function invalidConfirmationCode()
108
-    {
109
-        $error = ['status' => 400, 'message' => trans('core::errors.invalidConfirmationCode')];
110
-        abort($error['status'], $error['message']);
111
-    }
112
-
113
-    public function notFound($text)
114
-    {
115
-        $error = ['status' => 404, 'message' => trans('core::errors.notFound', ['replace' => $text])];
116
-        abort($error['status'], $error['message']);
117
-    }
118
-
119
-    public function generalError()
120
-    {
121
-        $error = ['status' => 400, 'message' => trans('core::errors.generalError')];
122
-        abort($error['status'], $error['message']);
123
-    }
5
+	public function unAuthorized()
6
+	{
7
+		$error = ['status' => 401, 'message' => trans('core::errors.unAuthorized')];
8
+		abort($error['status'], $error['message']);
9
+	}
10
+
11
+	public function invalidRefreshToken()
12
+	{
13
+		$error = ['status' => 400, 'message' => trans('core::errors.invalidRefreshToken')];
14
+		abort($error['status'], $error['message']);
15
+	}
16
+
17
+	public function noPermissions()
18
+	{
19
+		$error = ['status' => 403, 'message' => trans('core::errors.noPermissions')];
20
+		abort($error['status'], $error['message']);
21
+	}
22
+
23
+	public function loginFailed()
24
+	{
25
+		$error = ['status' => 400, 'message' => trans('core::errors.loginFailed')];
26
+		abort($error['status'], $error['message']);
27
+	}
28
+
29
+	public function noSocialEmail()
30
+	{
31
+		$error = ['status' => 400, 'message' => trans('core::errors.noSocialEmail')];
32
+		abort($error['status'], $error['message']);
33
+	}
34
+
35
+	public function userAlreadyRegistered()
36
+	{
37
+		$error = ['status' => 400, 'message' => trans('core::errors.userAlreadyRegistered')];
38
+		abort($error['status'], $error['message']);
39
+	}
40
+
41
+	public function connectionError()
42
+	{
43
+		$error = ['status' => 400, 'message' => trans('core::errors.connectionError')];
44
+		abort($error['status'], $error['message']);
45
+	}
46
+
47
+	public function redisNotRunning()
48
+	{
49
+		$error = ['status' => 400, 'message' => trans('core::errors.redisNotRunning')];
50
+		abort($error['status'], $error['message']);
51
+	}
52
+
53
+	public function dbQueryError()
54
+	{
55
+		$error = ['status' => 400, 'message' => trans('core::errors.dbQueryError')];
56
+		abort($error['status'], $error['message']);
57
+	}
58
+
59
+	public function cannotCreateSetting()
60
+	{
61
+		$error = ['status' => 400, 'message' => trans('core::errors.cannotCreateSetting')];
62
+		abort($error['status'], $error['message']);
63
+	}
64
+
65
+	public function cannotUpdateSettingKey()
66
+	{
67
+		$error = ['status' => 400, 'message' => trans('core::errors.cannotUpdateSettingKey')];
68
+		abort($error['status'], $error['message']);
69
+	}
70
+
71
+	public function userIsBlocked()
72
+	{
73
+		$error = ['status' => 403, 'message' => trans('core::errors.userIsBlocked')];
74
+		abort($error['status'], $error['message']);
75
+	}
76
+
77
+	public function emailNotConfirmed()
78
+	{
79
+		$error = ['status' => 403, 'message' => trans('core::errors.emailNotConfirmed')];
80
+		abort($error['status'], $error['message']);
81
+	}
82
+
83
+	public function emailAlreadyConfirmed()
84
+	{
85
+		$error = ['status' => 403, 'message' => trans('core::errors.emailAlreadyConfirmed')];
86
+		abort($error['status'], $error['message']);
87
+	}
88
+
89
+	public function invalidResetToken()
90
+	{
91
+		$error = ['status' => 400, 'message' => trans('core::errors.invalidResetToken')];
92
+		abort($error['status'], $error['message']);
93
+	}
94
+
95
+	public function invalidResetPassword()
96
+	{
97
+		$error = ['status' => 400, 'message' => trans('core::errors.invalidResetPassword')];
98
+		abort($error['status'], $error['message']);
99
+	}
100
+
101
+	public function invalidOldPassword()
102
+	{
103
+		$error = ['status' => 400, 'message' => trans('core::errors.invalidOldPassword')];
104
+		abort($error['status'], $error['message']);
105
+	}
106
+
107
+	public function invalidConfirmationCode()
108
+	{
109
+		$error = ['status' => 400, 'message' => trans('core::errors.invalidConfirmationCode')];
110
+		abort($error['status'], $error['message']);
111
+	}
112
+
113
+	public function notFound($text)
114
+	{
115
+		$error = ['status' => 404, 'message' => trans('core::errors.notFound', ['replace' => $text])];
116
+		abort($error['status'], $error['message']);
117
+	}
118
+
119
+	public function generalError()
120
+	{
121
+		$error = ['status' => 400, 'message' => trans('core::errors.generalError')];
122
+		abort($error['status'], $error['message']);
123
+	}
124 124
 }
Please login to merge, or discard this patch.
src/Modules/Core/Utl/ApiConsumer.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -214,7 +214,7 @@
 block discarded – undo
214 214
         $server = [];
215 215
 
216 216
         foreach ($headers as $headerType => $headerValue) {
217
-            $headerType = 'HTTP_' . $headerType;
217
+            $headerType = 'HTTP_'.$headerType;
218 218
 
219 219
             $server[$headerType] = $headerValue;
220 220
         }
Please login to merge, or discard this patch.
Indentation   +198 added lines, -198 removed lines patch added patch discarded remove patch
@@ -7,202 +7,202 @@
 block discarded – undo
7 7
 class ApiConsumer
8 8
 {
9 9
 
10
-    private $app;
11
-
12
-    private $router;
13
-
14
-    private $request;
15
-
16
-    private $disableMiddleware = false;
17
-
18
-    /**
19
-     * @param \Illuminate\Foundation\Application $app
20
-     * @param \Illuminate\Http\Request $request,
21
-     * @param \Illuminate\Routing\Router $router
22
-     */
23
-    public function __construct(Application $app, Request $request, LaravelRouter $router)
24
-    {
25
-        $this->app = $app;
26
-        $this->request = $request;
27
-        $this->router = $router;
28
-    }
29
-
30
-    /**
31
-     * @return \Illuminate\Http\Response
32
-     */
33
-    public function get()
34
-    {
35
-        return $this->quickCall('GET', func_get_args());
36
-    }
37
-
38
-    /**
39
-     * @return \Illuminate\Http\Response
40
-     */
41
-    public function post()
42
-    {
43
-        return $this->quickCall('POST', func_get_args());
44
-    }
45
-
46
-    /**
47
-     * @return \Illuminate\Http\Response
48
-     */
49
-    public function put()
50
-    {
51
-        return $this->quickCall('PUT', func_get_args());
52
-    }
53
-
54
-    /**
55
-     * @return \Illuminate\Http\Response
56
-     */
57
-    public function delete()
58
-    {
59
-        return $this->quickCall('DELETE', func_get_args());
60
-    }
61
-
62
-    /**
63
-     * @param  array $requests An array of requests
64
-     * @return array
65
-     */
66
-    public function batchRequest(array $requests)
67
-    {
68
-        foreach ($requests as $i => $request) {
69
-            $requests[$i] = call_user_func_array([$this, 'singleRequest'], $request);
70
-        }
71
-
72
-        return $requests;
73
-    }
74
-
75
-    /**
76
-     * @param  string $method
77
-     * @param  array  $args
78
-     * @return \Illuminate\Http\Response
79
-     */
80
-    public function quickCall($method, array $args)
81
-    {
82
-        array_unshift($args, $method);
83
-        return call_user_func_array([$this, "singleRequest"], $args);
84
-    }
85
-
86
-    /**
87
-     * @param  string $method
88
-     * @param  string $uri
89
-     * @param  array  $data
90
-     * @param  array  $headers
91
-     * @param  string $content
92
-     * @return \Illuminate\Http\Response
93
-     */
94
-    public function singleRequest($method, $uri, array $data = [], array $headers = [], $content = null)
95
-    {
96
-        // Save the current request so we can reset the router back to it
97
-        // after we've completed our internal request.
98
-        $currentRequest = $this->request->instance()->duplicate();
99
-
100
-        $headers = $this->overrideHeaders($currentRequest->server->getHeaders(), $headers);
101
-
102
-        if ($this->disableMiddleware) {
103
-            $this->app->instance('middleware.disable', true);
104
-        }
105
-
106
-        $response = $this->request($method, $uri, $data, $headers, $content);
107
-
108
-        if ($this->disableMiddleware) {
109
-            $this->app->instance('middleware.disable', false);
110
-        }
111
-
112
-        // Once the request has completed we reset the currentRequest of the router
113
-        // to match the original request.
114
-        $this->request->instance()->initialize(
115
-            $currentRequest->query->all(),
116
-            $currentRequest->request->all(),
117
-            $currentRequest->attributes->all(),
118
-            $currentRequest->cookies->all(),
119
-            $currentRequest->files->all(),
120
-            $currentRequest->server->all(),
121
-            $currentRequest->content
122
-        );
123
-
124
-        return $response;
125
-    }
126
-
127
-    private function overrideHeaders(array $default, array $headers)
128
-    {
129
-        $headers = $this->transformHeadersToUppercaseUnderscoreType($headers);
130
-        return array_merge($default, $headers);
131
-    }
132
-
133
-    public function enableMiddleware()
134
-    {
135
-        $this->disableMiddleware = false;
136
-    }
137
-
138
-    public function disableMiddleware()
139
-    {
140
-        $this->disableMiddleware = true;
141
-    }
142
-
143
-    /**
144
-     * @param  string $method
145
-     * @param  string $uri
146
-     * @param  array  $data
147
-     * @param  array  $headers
148
-     * @param  string $content
149
-     * @return \Illuminate\Http\Response
150
-     */
151
-    private function request($method, $uri, array $data = [], array $headers = [], $content = null)
152
-    {
153
-        // Create a new request object for the internal request
154
-        $request = $this->createRequest($method, $uri, $data, $headers, $content);
155
-
156
-        // Handle the request in the kernel and prepare a response
157
-        $response = $this->router->prepareResponse($request, $this->app->handle($request));
158
-
159
-        return $response;
160
-    }
161
-
162
-    /**
163
-     * @param  string $method
164
-     * @param  string $uri
165
-     * @param  array  $data
166
-     * @param  array  $headers
167
-     * @param  string $content
168
-     * @return \Illuminate\Http\Request
169
-     */
170
-    private function createRequest($method, $uri, array $data = [], array $headers = [], $content = null)
171
-    {
172
-        $server = $this->transformHeadersToServerVariables($headers);
173
-
174
-        return $this->request->create($uri, $method, $data, [], [], $server, $content);
175
-    }
176
-
177
-    private function transformHeadersToUppercaseUnderscoreType($headers)
178
-    {
179
-        $transformed = [];
180
-
181
-        foreach ($headers as $headerType => $headerValue) {
182
-            $headerType = strtoupper(str_replace('-', '_', $headerType));
183
-
184
-            $transformed[$headerType] = $headerValue;
185
-        }
186
-
187
-        return $transformed;
188
-    }
189
-
190
-    /**
191
-     * https://github.com/symfony/symfony/issues/5074
192
-     *
193
-     * @param  array $headers
194
-     * @return array
195
-     */
196
-    private function transformHeadersToServerVariables($headers)
197
-    {
198
-        $server = [];
199
-
200
-        foreach ($headers as $headerType => $headerValue) {
201
-            $headerType = 'HTTP_' . $headerType;
202
-
203
-            $server[$headerType] = $headerValue;
204
-        }
205
-
206
-        return $server;
207
-    }
10
+	private $app;
11
+
12
+	private $router;
13
+
14
+	private $request;
15
+
16
+	private $disableMiddleware = false;
17
+
18
+	/**
19
+	 * @param \Illuminate\Foundation\Application $app
20
+	 * @param \Illuminate\Http\Request $request,
21
+	 * @param \Illuminate\Routing\Router $router
22
+	 */
23
+	public function __construct(Application $app, Request $request, LaravelRouter $router)
24
+	{
25
+		$this->app = $app;
26
+		$this->request = $request;
27
+		$this->router = $router;
28
+	}
29
+
30
+	/**
31
+	 * @return \Illuminate\Http\Response
32
+	 */
33
+	public function get()
34
+	{
35
+		return $this->quickCall('GET', func_get_args());
36
+	}
37
+
38
+	/**
39
+	 * @return \Illuminate\Http\Response
40
+	 */
41
+	public function post()
42
+	{
43
+		return $this->quickCall('POST', func_get_args());
44
+	}
45
+
46
+	/**
47
+	 * @return \Illuminate\Http\Response
48
+	 */
49
+	public function put()
50
+	{
51
+		return $this->quickCall('PUT', func_get_args());
52
+	}
53
+
54
+	/**
55
+	 * @return \Illuminate\Http\Response
56
+	 */
57
+	public function delete()
58
+	{
59
+		return $this->quickCall('DELETE', func_get_args());
60
+	}
61
+
62
+	/**
63
+	 * @param  array $requests An array of requests
64
+	 * @return array
65
+	 */
66
+	public function batchRequest(array $requests)
67
+	{
68
+		foreach ($requests as $i => $request) {
69
+			$requests[$i] = call_user_func_array([$this, 'singleRequest'], $request);
70
+		}
71
+
72
+		return $requests;
73
+	}
74
+
75
+	/**
76
+	 * @param  string $method
77
+	 * @param  array  $args
78
+	 * @return \Illuminate\Http\Response
79
+	 */
80
+	public function quickCall($method, array $args)
81
+	{
82
+		array_unshift($args, $method);
83
+		return call_user_func_array([$this, "singleRequest"], $args);
84
+	}
85
+
86
+	/**
87
+	 * @param  string $method
88
+	 * @param  string $uri
89
+	 * @param  array  $data
90
+	 * @param  array  $headers
91
+	 * @param  string $content
92
+	 * @return \Illuminate\Http\Response
93
+	 */
94
+	public function singleRequest($method, $uri, array $data = [], array $headers = [], $content = null)
95
+	{
96
+		// Save the current request so we can reset the router back to it
97
+		// after we've completed our internal request.
98
+		$currentRequest = $this->request->instance()->duplicate();
99
+
100
+		$headers = $this->overrideHeaders($currentRequest->server->getHeaders(), $headers);
101
+
102
+		if ($this->disableMiddleware) {
103
+			$this->app->instance('middleware.disable', true);
104
+		}
105
+
106
+		$response = $this->request($method, $uri, $data, $headers, $content);
107
+
108
+		if ($this->disableMiddleware) {
109
+			$this->app->instance('middleware.disable', false);
110
+		}
111
+
112
+		// Once the request has completed we reset the currentRequest of the router
113
+		// to match the original request.
114
+		$this->request->instance()->initialize(
115
+			$currentRequest->query->all(),
116
+			$currentRequest->request->all(),
117
+			$currentRequest->attributes->all(),
118
+			$currentRequest->cookies->all(),
119
+			$currentRequest->files->all(),
120
+			$currentRequest->server->all(),
121
+			$currentRequest->content
122
+		);
123
+
124
+		return $response;
125
+	}
126
+
127
+	private function overrideHeaders(array $default, array $headers)
128
+	{
129
+		$headers = $this->transformHeadersToUppercaseUnderscoreType($headers);
130
+		return array_merge($default, $headers);
131
+	}
132
+
133
+	public function enableMiddleware()
134
+	{
135
+		$this->disableMiddleware = false;
136
+	}
137
+
138
+	public function disableMiddleware()
139
+	{
140
+		$this->disableMiddleware = true;
141
+	}
142
+
143
+	/**
144
+	 * @param  string $method
145
+	 * @param  string $uri
146
+	 * @param  array  $data
147
+	 * @param  array  $headers
148
+	 * @param  string $content
149
+	 * @return \Illuminate\Http\Response
150
+	 */
151
+	private function request($method, $uri, array $data = [], array $headers = [], $content = null)
152
+	{
153
+		// Create a new request object for the internal request
154
+		$request = $this->createRequest($method, $uri, $data, $headers, $content);
155
+
156
+		// Handle the request in the kernel and prepare a response
157
+		$response = $this->router->prepareResponse($request, $this->app->handle($request));
158
+
159
+		return $response;
160
+	}
161
+
162
+	/**
163
+	 * @param  string $method
164
+	 * @param  string $uri
165
+	 * @param  array  $data
166
+	 * @param  array  $headers
167
+	 * @param  string $content
168
+	 * @return \Illuminate\Http\Request
169
+	 */
170
+	private function createRequest($method, $uri, array $data = [], array $headers = [], $content = null)
171
+	{
172
+		$server = $this->transformHeadersToServerVariables($headers);
173
+
174
+		return $this->request->create($uri, $method, $data, [], [], $server, $content);
175
+	}
176
+
177
+	private function transformHeadersToUppercaseUnderscoreType($headers)
178
+	{
179
+		$transformed = [];
180
+
181
+		foreach ($headers as $headerType => $headerValue) {
182
+			$headerType = strtoupper(str_replace('-', '_', $headerType));
183
+
184
+			$transformed[$headerType] = $headerValue;
185
+		}
186
+
187
+		return $transformed;
188
+	}
189
+
190
+	/**
191
+	 * https://github.com/symfony/symfony/issues/5074
192
+	 *
193
+	 * @param  array $headers
194
+	 * @return array
195
+	 */
196
+	private function transformHeadersToServerVariables($headers)
197
+	{
198
+		$server = [];
199
+
200
+		foreach ($headers as $headerType => $headerValue) {
201
+			$headerType = 'HTTP_' . $headerType;
202
+
203
+			$server[$headerType] = $headerValue;
204
+		}
205
+
206
+		return $server;
207
+	}
208 208
 }
Please login to merge, or discard this patch.
src/Modules/Core/ModelObservers/SettingsObserver.php 1 patch
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -6,67 +6,67 @@
 block discarded – undo
6 6
 class SettingsObserver
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
-    /**
20
-     * Prevent the creating of the settings.
21
-     *
22
-     * @param  object $model the model beign created.
23
-     * @return void
24
-     */
25
-    public function creating($model)
26
-    {
27
-        \ErrorHandler::cannotCreateSetting();
28
-    }
19
+	/**
20
+	 * Prevent the creating of the settings.
21
+	 *
22
+	 * @param  object $model the model beign created.
23
+	 * @return void
24
+	 */
25
+	public function creating($model)
26
+	{
27
+		\ErrorHandler::cannotCreateSetting();
28
+	}
29 29
 
30
-    public function created($model)
31
-    {
32
-        //
33
-    }
30
+	public function created($model)
31
+	{
32
+		//
33
+	}
34 34
 
35
-    /**
36
-     * Prevent updating of the setting key.
37
-     *
38
-     * @param  object $model the model beign updated.
39
-     * @return void
40
-     */
41
-    public function updating($model)
42
-    {
43
-        if ($model->getOriginal('key') !== $model->key) {
44
-            \ErrorHandler::cannotUpdateSettingKey();
45
-        }
46
-    }
35
+	/**
36
+	 * Prevent updating of the setting key.
37
+	 *
38
+	 * @param  object $model the model beign updated.
39
+	 * @return void
40
+	 */
41
+	public function updating($model)
42
+	{
43
+		if ($model->getOriginal('key') !== $model->key) {
44
+			\ErrorHandler::cannotUpdateSettingKey();
45
+		}
46
+	}
47 47
 
48
-    public function updated($model)
49
-    {
50
-        //
51
-    }
48
+	public function updated($model)
49
+	{
50
+		//
51
+	}
52 52
 
53
-    public function deleting($model)
54
-    {
55
-        //
56
-    }
53
+	public function deleting($model)
54
+	{
55
+		//
56
+	}
57 57
 
58
-    public function deleted($model)
59
-    {
60
-        //
61
-    }
58
+	public function deleted($model)
59
+	{
60
+		//
61
+	}
62 62
 
63
-    public function restoring($model)
64
-    {
65
-        //
66
-    }
63
+	public function restoring($model)
64
+	{
65
+		//
66
+	}
67 67
 
68
-    public function restored($model)
69
-    {
70
-        //
71
-    }
68
+	public function restored($model)
69
+	{
70
+		//
71
+	}
72 72
 }
Please login to merge, or discard this patch.
src/Modules/Core/Traits/Translatable.php 2 patches
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -2,46 +2,46 @@
 block discarded – undo
2 2
 
3 3
 trait Translatable
4 4
 {
5
-    /**
6
-     * Create a new model instance that is existing.
7
-     *
8
-     * @param  array  $attributes
9
-     * @param  string|null  $connection
10
-     * @return static
11
-     */
12
-    public function newFromBuilder($attributes = [], $connection = null)
13
-    {
14
-        $model = parent::newFromBuilder($attributes, $connection);
5
+	/**
6
+	 * Create a new model instance that is existing.
7
+	 *
8
+	 * @param  array  $attributes
9
+	 * @param  string|null  $connection
10
+	 * @return static
11
+	 */
12
+	public function newFromBuilder($attributes = [], $connection = null)
13
+	{
14
+		$model = parent::newFromBuilder($attributes, $connection);
15 15
 
16
-        foreach ($model->attributes as $key => $value) {
17
-            if (isset($this->translatable) && in_array($key, $this->translatable)) {
18
-                $model->$key = $this->getTranslatedAttribute($value);
19
-            }
20
-        }
16
+		foreach ($model->attributes as $key => $value) {
17
+			if (isset($this->translatable) && in_array($key, $this->translatable)) {
18
+				$model->$key = $this->getTranslatedAttribute($value);
19
+			}
20
+		}
21 21
 
22
-        return $model;
23
-    }
22
+		return $model;
23
+	}
24 24
 
25
-    /**
26
-     * Returns a translatable model attribute based on the application's locale settings.
27
-     *
28
-     * @param $values
29
-     * @return string
30
-     */
31
-    protected function getTranslatedAttribute($values)
32
-    {
33
-        $values         = json_decode($values);
34
-        $primaryLocale  = \Session::get('locale');
35
-        $fallbackLocale = 'en';
25
+	/**
26
+	 * Returns a translatable model attribute based on the application's locale settings.
27
+	 *
28
+	 * @param $values
29
+	 * @return string
30
+	 */
31
+	protected function getTranslatedAttribute($values)
32
+	{
33
+		$values         = json_decode($values);
34
+		$primaryLocale  = \Session::get('locale');
35
+		$fallbackLocale = 'en';
36 36
 
37
-        if ($primaryLocale == 'all') {
38
-            return $values;
39
-        }
37
+		if ($primaryLocale == 'all') {
38
+			return $values;
39
+		}
40 40
 
41
-        if (! $primaryLocale || ! is_object($values) || ! property_exists($values, $primaryLocale)) {
42
-            return $values ? isset($values->$fallbackLocale) ? $values->$fallbackLocale : $values : '';
43
-        }
41
+		if (! $primaryLocale || ! is_object($values) || ! property_exists($values, $primaryLocale)) {
42
+			return $values ? isset($values->$fallbackLocale) ? $values->$fallbackLocale : $values : '';
43
+		}
44 44
 
45
-        return $primaryLocale == 'all' ? $values : $values->$primaryLocale;
46
-    }
45
+		return $primaryLocale == 'all' ? $values : $values->$primaryLocale;
46
+	}
47 47
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
             return $values;
39 39
         }
40 40
 
41
-        if (! $primaryLocale || ! is_object($values) || ! property_exists($values, $primaryLocale)) {
41
+        if ( ! $primaryLocale || ! is_object($values) || ! property_exists($values, $primaryLocale)) {
42 42
             return $values ? isset($values->$fallbackLocale) ? $values->$fallbackLocale : $values : '';
43 43
         }
44 44
 
Please login to merge, or discard this patch.
src/Modules/Core/Repositories/SettingRepository.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
      */
23 23
     public function saveMany(array $data)
24 24
     {
25
-        \DB::transaction(function () use ($data) {
25
+        \DB::transaction(function() use ($data) {
26 26
             foreach ($data as $value) {
27 27
                 $this->save($value);
28 28
             }
Please login to merge, or discard this patch.
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -5,29 +5,29 @@
 block discarded – undo
5 5
 
6 6
 class SettingRepository extends BaseRepository
7 7
 {
8
-    /**
9
-     * Init new object.
10
-     *
11
-     * @param   Setting $model
12
-     * @return  void
13
-     */
14
-    public function __construct(Setting $model)
15
-    {
16
-        parent::__construct($model);
17
-    }
8
+	/**
9
+	 * Init new object.
10
+	 *
11
+	 * @param   Setting $model
12
+	 * @return  void
13
+	 */
14
+	public function __construct(Setting $model)
15
+	{
16
+		parent::__construct($model);
17
+	}
18 18
 
19
-    /**
20
-     * Save list of settings.
21
-     *
22
-     * @param  array   $data
23
-     * @return void
24
-     */
25
-    public function saveMany(array $data)
26
-    {
27
-        \DB::transaction(function () use ($data) {
28
-            foreach ($data as $value) {
29
-                $this->save($value);
30
-            }
31
-        });
32
-    }
19
+	/**
20
+	 * Save list of settings.
21
+	 *
22
+	 * @param  array   $data
23
+	 * @return void
24
+	 */
25
+	public function saveMany(array $data)
26
+	{
27
+		\DB::transaction(function () use ($data) {
28
+			foreach ($data as $value) {
29
+				$this->save($value);
30
+			}
31
+		});
32
+	}
33 33
 }
Please login to merge, or discard this patch.