Completed
Push — master ( 21ebc1...3cae80 )
by Sherif
05:55
created
src/Modules/V1/Core/Http/Controllers/BaseApiController.php 2 patches
Doc Comments   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
      * Fetch all records with relations from model repository.
63 63
      * 
64 64
      * @param  string  $sortBy
65
-     * @param  boolean $desc
66
-     * @return \Illuminate\Http\Response
65
+     * @param  integer $desc
66
+     * @return \Illuminate\Http\JsonResponse|null
67 67
      */
68 68
     public function index($sortBy = 'created_at', $desc = 1) 
69 69
     {
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
      * Fetch the single object with relations from model repository.
79 79
      * 
80 80
      * @param  integer $id
81
-     * @return \Illuminate\Http\Response
81
+     * @return \Illuminate\Http\JsonResponse|null
82 82
      */
83 83
     public function find($id) 
84 84
     {
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
      * @param  string  $query
97 97
      * @param  integer $perPage
98 98
      * @param  string  $sortBy
99
-     * @param  boolean $desc
100
-     * @return \Illuminate\Http\Response
99
+     * @param  integer $desc
100
+     * @return \Illuminate\Http\JsonResponse|null
101 101
      */
102 102
     public function search($query = '', $perPage = 15, $sortBy = 'created_at', $desc = 1) 
103 103
     {
@@ -114,8 +114,8 @@  discard block
 block discarded – undo
114 114
      * 
115 115
      * @param  \Illuminate\Http\Request  $request
116 116
      * @param  string  $sortBy
117
-     * @param  boolean $desc
118
-     * @return \Illuminate\Http\Response
117
+     * @param  integer $desc
118
+     * @return \Illuminate\Http\JsonResponse|null
119 119
      */
120 120
     public function findby(Request $request, $sortBy = 'created_at', $desc = 1) 
121 121
     {
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
      * condition.
132 132
      * 
133 133
      * @param  \Illuminate\Http\Request  $request
134
-     * @return \Illuminate\Http\Response
134
+     * @return \Illuminate\Http\JsonResponse|null
135 135
      */
136 136
     public function first(Request $request) 
137 137
     {
@@ -147,8 +147,8 @@  discard block
 block discarded – undo
147 147
      * 
148 148
      * @param  integer $perPage
149 149
      * @param  string  $sortBy
150
-     * @param  boolean $desc
151
-     * @return \Illuminate\Http\Response
150
+     * @param  integer $desc
151
+     * @return \Illuminate\Http\JsonResponse|null
152 152
      */
153 153
     public function paginate($perPage = 15, $sortBy = 'created_at', $desc = 1) 
154 154
     {
@@ -166,8 +166,8 @@  discard block
 block discarded – undo
166 166
      * @param  \Illuminate\Http\Request  $request
167 167
      * @param  integer $perPage
168 168
      * @param  string  $sortBy
169
-     * @param  boolean $desc
170
-     * @return \Illuminate\Http\Response
169
+     * @param  integer $desc
170
+     * @return \Illuminate\Http\JsonResponse|null
171 171
      */
172 172
     public function paginateby(Request $request, $perPage = 15, $sortBy = 'created_at', $desc = 1) 
173 173
     {
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
      * Save the given model to repository.
183 183
      * 
184 184
      * @param  \Illuminate\Http\Request  $request
185
-     * @return \Illuminate\Http\Response
185
+     * @return \Illuminate\Http\JsonResponse|null
186 186
      */
187 187
     public function save(Request $request) 
188 188
     {
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
      * Delete by the given id from model repository.
216 216
      * 
217 217
      * @param  integer  $id
218
-     * @return \Illuminate\Http\Response
218
+     * @return \Illuminate\Http\JsonResponse|null
219 219
      */
220 220
     public function delete($id) 
221 221
     {
@@ -231,8 +231,8 @@  discard block
 block discarded – undo
231 231
      * @param  \Illuminate\Http\Request  $request
232 232
      * @param  integer $perPage
233 233
      * @param  string  $sortBy
234
-     * @param  boolean $desc
235
-     * @return \Illuminate\Http\Response
234
+     * @param  integer $desc
235
+     * @return \Illuminate\Http\JsonResponse
236 236
      */
237 237
     public function deleted(Request $request, $perPage = 15, $sortBy = 'created_at', $desc = 1) 
238 238
     {
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
      * Restore the deleted model.
244 244
      * 
245 245
      * @param  integer  $id
246
-     * @return \Illuminate\Http\Response
246
+     * @return \Illuminate\Http\JsonResponse|null
247 247
      */
248 248
     public function restore($id) 
249 249
     {
Please login to merge, or discard this patch.
Indentation   +247 added lines, -247 removed lines patch added patch discarded remove patch
@@ -6,274 +6,274 @@
 block discarded – undo
6 6
 
7 7
 class BaseApiController extends Controller
8 8
 {
9
-    /**
10
-     * The model implementation.
11
-     * 
12
-     * @var model
13
-     */
14
-    protected $model;
9
+	/**
10
+	 * The model implementation.
11
+	 * 
12
+	 * @var model
13
+	 */
14
+	protected $model;
15 15
 
16
-    /**
17
-     * The config implementation.
18
-     * 
19
-     * @var config
20
-     */
21
-    protected $config;
16
+	/**
17
+	 * The config implementation.
18
+	 * 
19
+	 * @var config
20
+	 */
21
+	protected $config;
22 22
 
23
-    public function __construct()
24
-    {
25
-        \Session::put('timeZoneDiff', \Request::header('time-zone-diff') ?: 0);
23
+	public function __construct()
24
+	{
25
+		\Session::put('timeZoneDiff', \Request::header('time-zone-diff') ?: 0);
26 26
 
27
-        $locale = \Request::header('locale');
28
-        switch ($locale) 
29
-        {
30
-            case 'en':
31
-            \App::setLocale('en');
32
-            \Session::put('locale', 'en');
33
-            break;
27
+		$locale = \Request::header('locale');
28
+		switch ($locale) 
29
+		{
30
+			case 'en':
31
+			\App::setLocale('en');
32
+			\Session::put('locale', 'en');
33
+			break;
34 34
 
35
-            case 'ar':
36
-            \App::setLocale('ar');
37
-            \Session::put('locale', 'ar');
38
-            break;
35
+			case 'ar':
36
+			\App::setLocale('ar');
37
+			\Session::put('locale', 'ar');
38
+			break;
39 39
 
40
-            case 'all':
41
-            \App::setLocale('en');
42
-            \Session::put('locale', 'all');
43
-            break;
40
+			case 'all':
41
+			\App::setLocale('en');
42
+			\Session::put('locale', 'all');
43
+			break;
44 44
 
45
-            default:
46
-            \App::setLocale('en');
47
-            \Session::put('locale', 'en');
48
-            break;
49
-        }
45
+			default:
46
+			\App::setLocale('en');
47
+			\Session::put('locale', 'en');
48
+			break;
49
+		}
50 50
         
51
-        $this->config              = \CoreConfig::getConfig();
52
-        $this->model               = property_exists($this, 'model') ? $this->model : false;
53
-        $this->validationRules     = property_exists($this, 'validationRules') ? $this->validationRules : false;
54
-        $this->skipPermissionCheck = property_exists($this, 'skipPermissionCheck') ? $this->skipPermissionCheck : [];
55
-        $this->skipLoginCheck      = property_exists($this, 'skipLoginCheck') ? $this->skipLoginCheck : [];
56
-        $this->relations           = array_key_exists($this->model, $this->config['relations']) ? $this->config['relations'][$this->model] : false;
57
-        $route                     = explode('@',\Route::currentRouteAction())[1];
58
-        $this->checkPermission($route);
59
-    }
51
+		$this->config              = \CoreConfig::getConfig();
52
+		$this->model               = property_exists($this, 'model') ? $this->model : false;
53
+		$this->validationRules     = property_exists($this, 'validationRules') ? $this->validationRules : false;
54
+		$this->skipPermissionCheck = property_exists($this, 'skipPermissionCheck') ? $this->skipPermissionCheck : [];
55
+		$this->skipLoginCheck      = property_exists($this, 'skipLoginCheck') ? $this->skipLoginCheck : [];
56
+		$this->relations           = array_key_exists($this->model, $this->config['relations']) ? $this->config['relations'][$this->model] : false;
57
+		$route                     = explode('@',\Route::currentRouteAction())[1];
58
+		$this->checkPermission($route);
59
+	}
60 60
 
61
-    /**
62
-     * Fetch all records with relations from model repository.
63
-     * 
64
-     * @param  string  $sortBy
65
-     * @param  boolean $desc
66
-     * @return \Illuminate\Http\Response
67
-     */
68
-    public function index($sortBy = 'created_at', $desc = 1) 
69
-    {
70
-        if ($this->model)
71
-        {
72
-            $relations = $this->relations && $this->relations['all'] ? $this->relations['all'] : [];
73
-            return \Response::json(call_user_func_array("\Core::{$this->model}", [])->all($relations, $sortBy, $desc), 200);
74
-        }
75
-    }
61
+	/**
62
+	 * Fetch all records with relations from model repository.
63
+	 * 
64
+	 * @param  string  $sortBy
65
+	 * @param  boolean $desc
66
+	 * @return \Illuminate\Http\Response
67
+	 */
68
+	public function index($sortBy = 'created_at', $desc = 1) 
69
+	{
70
+		if ($this->model)
71
+		{
72
+			$relations = $this->relations && $this->relations['all'] ? $this->relations['all'] : [];
73
+			return \Response::json(call_user_func_array("\Core::{$this->model}", [])->all($relations, $sortBy, $desc), 200);
74
+		}
75
+	}
76 76
 
77
-    /**
78
-     * Fetch the single object with relations from model repository.
79
-     * 
80
-     * @param  integer $id
81
-     * @return \Illuminate\Http\Response
82
-     */
83
-    public function find($id) 
84
-    {
85
-        if ($this->model) 
86
-        {
87
-            $relations = $this->relations && $this->relations['find'] ? $this->relations['find'] : [];
88
-            return \Response::json(call_user_func_array("\Core::{$this->model}", [])->find($id, $relations), 200);
89
-        }
90
-    }
77
+	/**
78
+	 * Fetch the single object with relations from model repository.
79
+	 * 
80
+	 * @param  integer $id
81
+	 * @return \Illuminate\Http\Response
82
+	 */
83
+	public function find($id) 
84
+	{
85
+		if ($this->model) 
86
+		{
87
+			$relations = $this->relations && $this->relations['find'] ? $this->relations['find'] : [];
88
+			return \Response::json(call_user_func_array("\Core::{$this->model}", [])->find($id, $relations), 200);
89
+		}
90
+	}
91 91
 
92
-    /**
93
-     * Paginate all records with relations from model repository
94
-     * that matche the given query.
95
-     * 
96
-     * @param  string  $query
97
-     * @param  integer $perPage
98
-     * @param  string  $sortBy
99
-     * @param  boolean $desc
100
-     * @return \Illuminate\Http\Response
101
-     */
102
-    public function search($query = '', $perPage = 15, $sortBy = 'created_at', $desc = 1) 
103
-    {
104
-        if ($this->model) 
105
-        {
106
-            $relations = $this->relations && $this->relations['search'] ? $this->relations['search'] : [];
107
-            return \Response::json(call_user_func_array("\Core::{$this->model}", [])->search($query, $perPage, $relations, $sortBy, $desc), 200);
108
-        }
109
-    }
92
+	/**
93
+	 * Paginate all records with relations from model repository
94
+	 * that matche the given query.
95
+	 * 
96
+	 * @param  string  $query
97
+	 * @param  integer $perPage
98
+	 * @param  string  $sortBy
99
+	 * @param  boolean $desc
100
+	 * @return \Illuminate\Http\Response
101
+	 */
102
+	public function search($query = '', $perPage = 15, $sortBy = 'created_at', $desc = 1) 
103
+	{
104
+		if ($this->model) 
105
+		{
106
+			$relations = $this->relations && $this->relations['search'] ? $this->relations['search'] : [];
107
+			return \Response::json(call_user_func_array("\Core::{$this->model}", [])->search($query, $perPage, $relations, $sortBy, $desc), 200);
108
+		}
109
+	}
110 110
 
111
-    /**
112
-     * Fetch records from the storage based on the given
113
-     * condition.
114
-     * 
115
-     * @param  \Illuminate\Http\Request  $request
116
-     * @param  string  $sortBy
117
-     * @param  boolean $desc
118
-     * @return \Illuminate\Http\Response
119
-     */
120
-    public function findby(Request $request, $sortBy = 'created_at', $desc = 1) 
121
-    {
122
-        if ($this->model) 
123
-        {
124
-            $relations = $this->relations && $this->relations['findBy'] ? $this->relations['findBy'] : [];
125
-            return \Response::json(call_user_func_array("\Core::{$this->model}", [])->findBy($request->all(), $relations, $sortBy, $desc), 200);
126
-        }
127
-    }
111
+	/**
112
+	 * Fetch records from the storage based on the given
113
+	 * condition.
114
+	 * 
115
+	 * @param  \Illuminate\Http\Request  $request
116
+	 * @param  string  $sortBy
117
+	 * @param  boolean $desc
118
+	 * @return \Illuminate\Http\Response
119
+	 */
120
+	public function findby(Request $request, $sortBy = 'created_at', $desc = 1) 
121
+	{
122
+		if ($this->model) 
123
+		{
124
+			$relations = $this->relations && $this->relations['findBy'] ? $this->relations['findBy'] : [];
125
+			return \Response::json(call_user_func_array("\Core::{$this->model}", [])->findBy($request->all(), $relations, $sortBy, $desc), 200);
126
+		}
127
+	}
128 128
 
129
-    /**
130
-     * Fetch the first record from the storage based on the given
131
-     * condition.
132
-     * 
133
-     * @param  \Illuminate\Http\Request  $request
134
-     * @return \Illuminate\Http\Response
135
-     */
136
-    public function first(Request $request) 
137
-    {
138
-        if ($this->model) 
139
-        {
140
-            $relations = $this->relations && $this->relations['first'] ? $this->relations['first'] : [];
141
-            return \Response::json(call_user_func_array("\Core::{$this->model}", [])->first($request->all(), $relations), 200);
142
-        }
143
-    }
129
+	/**
130
+	 * Fetch the first record from the storage based on the given
131
+	 * condition.
132
+	 * 
133
+	 * @param  \Illuminate\Http\Request  $request
134
+	 * @return \Illuminate\Http\Response
135
+	 */
136
+	public function first(Request $request) 
137
+	{
138
+		if ($this->model) 
139
+		{
140
+			$relations = $this->relations && $this->relations['first'] ? $this->relations['first'] : [];
141
+			return \Response::json(call_user_func_array("\Core::{$this->model}", [])->first($request->all(), $relations), 200);
142
+		}
143
+	}
144 144
 
145
-    /**
146
-     * Paginate all records with relations from model repository.
147
-     * 
148
-     * @param  integer $perPage
149
-     * @param  string  $sortBy
150
-     * @param  boolean $desc
151
-     * @return \Illuminate\Http\Response
152
-     */
153
-    public function paginate($perPage = 15, $sortBy = 'created_at', $desc = 1) 
154
-    {
155
-        if ($this->model) 
156
-        {
157
-            $relations = $this->relations && $this->relations['paginate'] ? $this->relations['paginate'] : [];
158
-            return \Response::json(call_user_func_array("\Core::{$this->model}", [])->paginate($perPage, $relations, $sortBy, $desc), 200);
159
-        }
160
-    }
145
+	/**
146
+	 * Paginate all records with relations from model repository.
147
+	 * 
148
+	 * @param  integer $perPage
149
+	 * @param  string  $sortBy
150
+	 * @param  boolean $desc
151
+	 * @return \Illuminate\Http\Response
152
+	 */
153
+	public function paginate($perPage = 15, $sortBy = 'created_at', $desc = 1) 
154
+	{
155
+		if ($this->model) 
156
+		{
157
+			$relations = $this->relations && $this->relations['paginate'] ? $this->relations['paginate'] : [];
158
+			return \Response::json(call_user_func_array("\Core::{$this->model}", [])->paginate($perPage, $relations, $sortBy, $desc), 200);
159
+		}
160
+	}
161 161
 
162
-    /**
163
-     * Fetch all records with relations based on
164
-     * the given condition from storage in pages.
165
-     * 
166
-     * @param  \Illuminate\Http\Request  $request
167
-     * @param  integer $perPage
168
-     * @param  string  $sortBy
169
-     * @param  boolean $desc
170
-     * @return \Illuminate\Http\Response
171
-     */
172
-    public function paginateby(Request $request, $perPage = 15, $sortBy = 'created_at', $desc = 1) 
173
-    {
174
-        if ($this->model) 
175
-        {
176
-            $relations = $this->relations && $this->relations['paginateBy'] ? $this->relations['paginateBy'] : [];
177
-            return \Response::json(call_user_func_array("\Core::{$this->model}", [])->paginateBy($request->all(), $perPage, $relations, $sortBy, $desc), 200);
178
-        }
179
-    }
162
+	/**
163
+	 * Fetch all records with relations based on
164
+	 * the given condition from storage in pages.
165
+	 * 
166
+	 * @param  \Illuminate\Http\Request  $request
167
+	 * @param  integer $perPage
168
+	 * @param  string  $sortBy
169
+	 * @param  boolean $desc
170
+	 * @return \Illuminate\Http\Response
171
+	 */
172
+	public function paginateby(Request $request, $perPage = 15, $sortBy = 'created_at', $desc = 1) 
173
+	{
174
+		if ($this->model) 
175
+		{
176
+			$relations = $this->relations && $this->relations['paginateBy'] ? $this->relations['paginateBy'] : [];
177
+			return \Response::json(call_user_func_array("\Core::{$this->model}", [])->paginateBy($request->all(), $perPage, $relations, $sortBy, $desc), 200);
178
+		}
179
+	}
180 180
 
181
-    /**
182
-     * Save the given model to repository.
183
-     * 
184
-     * @param  \Illuminate\Http\Request  $request
185
-     * @return \Illuminate\Http\Response
186
-     */
187
-    public function save(Request $request) 
188
-    {
189
-        foreach ($this->validationRules as &$rule) 
190
-        {
191
-            if (strpos($rule, 'exists') && ! strpos($rule, 'deleted_at,NULL')) 
192
-            {
193
-                $rule .= ',deleted_at,NULL';
194
-            }
181
+	/**
182
+	 * Save the given model to repository.
183
+	 * 
184
+	 * @param  \Illuminate\Http\Request  $request
185
+	 * @return \Illuminate\Http\Response
186
+	 */
187
+	public function save(Request $request) 
188
+	{
189
+		foreach ($this->validationRules as &$rule) 
190
+		{
191
+			if (strpos($rule, 'exists') && ! strpos($rule, 'deleted_at,NULL')) 
192
+			{
193
+				$rule .= ',deleted_at,NULL';
194
+			}
195 195
 
196
-            if ($request->has('id')) 
197
-            {
198
-                $rule = str_replace('{id}', $request->get('id'), $rule);
199
-            }
200
-            else
201
-            {
202
-                $rule = str_replace(',{id}', '', $rule);
203
-            }
204
-        }
196
+			if ($request->has('id')) 
197
+			{
198
+				$rule = str_replace('{id}', $request->get('id'), $rule);
199
+			}
200
+			else
201
+			{
202
+				$rule = str_replace(',{id}', '', $rule);
203
+			}
204
+		}
205 205
         
206
-        $this->validate($request, $this->validationRules);
206
+		$this->validate($request, $this->validationRules);
207 207
 
208
-        if ($this->model) 
209
-        {
210
-            return \Response::json(call_user_func_array("\Core::{$this->model}", [])->save($request->all()), 200);
211
-        }
212
-    }
208
+		if ($this->model) 
209
+		{
210
+			return \Response::json(call_user_func_array("\Core::{$this->model}", [])->save($request->all()), 200);
211
+		}
212
+	}
213 213
 
214
-    /**
215
-     * Delete by the given id from model repository.
216
-     * 
217
-     * @param  integer  $id
218
-     * @return \Illuminate\Http\Response
219
-     */
220
-    public function delete($id) 
221
-    {
222
-        if ($this->model) 
223
-        {
224
-            return \Response::json(call_user_func_array("\Core::{$this->model}", [])->delete($id), 200);
225
-        }
226
-    }
214
+	/**
215
+	 * Delete by the given id from model repository.
216
+	 * 
217
+	 * @param  integer  $id
218
+	 * @return \Illuminate\Http\Response
219
+	 */
220
+	public function delete($id) 
221
+	{
222
+		if ($this->model) 
223
+		{
224
+			return \Response::json(call_user_func_array("\Core::{$this->model}", [])->delete($id), 200);
225
+		}
226
+	}
227 227
 
228
-    /**
229
-     * Return the deleted models in pages based on the given conditions.
230
-     *
231
-     * @param  \Illuminate\Http\Request  $request
232
-     * @param  integer $perPage
233
-     * @param  string  $sortBy
234
-     * @param  boolean $desc
235
-     * @return \Illuminate\Http\Response
236
-     */
237
-    public function deleted(Request $request, $perPage = 15, $sortBy = 'created_at', $desc = 1) 
238
-    {
239
-        return \Response::json(call_user_func_array("\Core::{$this->model}", [])->deleted($request->all(), $perPage, $sortBy, $desc), 200);
240
-    }
228
+	/**
229
+	 * Return the deleted models in pages based on the given conditions.
230
+	 *
231
+	 * @param  \Illuminate\Http\Request  $request
232
+	 * @param  integer $perPage
233
+	 * @param  string  $sortBy
234
+	 * @param  boolean $desc
235
+	 * @return \Illuminate\Http\Response
236
+	 */
237
+	public function deleted(Request $request, $perPage = 15, $sortBy = 'created_at', $desc = 1) 
238
+	{
239
+		return \Response::json(call_user_func_array("\Core::{$this->model}", [])->deleted($request->all(), $perPage, $sortBy, $desc), 200);
240
+	}
241 241
 
242
-    /**
243
-     * Restore the deleted model.
244
-     * 
245
-     * @param  integer  $id
246
-     * @return \Illuminate\Http\Response
247
-     */
248
-    public function restore($id) 
249
-    {
250
-        if ($this->model) 
251
-        {
252
-            return \Response::json(call_user_func_array("\Core::{$this->model}", [])->restore($id), 200);
253
-        }
254
-    }
242
+	/**
243
+	 * Restore the deleted model.
244
+	 * 
245
+	 * @param  integer  $id
246
+	 * @return \Illuminate\Http\Response
247
+	 */
248
+	public function restore($id) 
249
+	{
250
+		if ($this->model) 
251
+		{
252
+			return \Response::json(call_user_func_array("\Core::{$this->model}", [])->restore($id), 200);
253
+		}
254
+	}
255 255
 
256
-    /**
257
-     * Check if the logged in user can do the given permission.
258
-     * 
259
-     * @param  string $permission
260
-     * @return void
261
-     */
262
-    private function checkPermission($permission)
263
-    {
264
-        $permission = $permission !== 'index' ? $permission : 'list';
265
-        if ( ! in_array($permission, $this->skipLoginCheck)) 
266
-        {
267
-            $user = \Core::users()->find(\JWTAuth::parseToken()->authenticate()->id);
268
-            if ($user->blocked)
269
-            {
270
-                \ErrorHandler::userIsBlocked();
271
-            }
256
+	/**
257
+	 * Check if the logged in user can do the given permission.
258
+	 * 
259
+	 * @param  string $permission
260
+	 * @return void
261
+	 */
262
+	private function checkPermission($permission)
263
+	{
264
+		$permission = $permission !== 'index' ? $permission : 'list';
265
+		if ( ! in_array($permission, $this->skipLoginCheck)) 
266
+		{
267
+			$user = \Core::users()->find(\JWTAuth::parseToken()->authenticate()->id);
268
+			if ($user->blocked)
269
+			{
270
+				\ErrorHandler::userIsBlocked();
271
+			}
272 272
             
273
-            if ( ! in_array($permission, $this->skipPermissionCheck) && ! \Core::users()->can($permission, $this->model))
274
-            {
275
-                \ErrorHandler::noPermissions();
276
-            }
277
-        }
278
-    }
273
+			if ( ! in_array($permission, $this->skipPermissionCheck) && ! \Core::users()->can($permission, $this->model))
274
+			{
275
+				\ErrorHandler::noPermissions();
276
+			}
277
+		}
278
+	}
279 279
 }
Please login to merge, or discard this patch.
src/Modules/V1/Core/Database/Migrations/2016_01_24_123630_settings.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -13,13 +13,13 @@
 block discarded – undo
13 13
 	public function up()
14 14
 	{
15 15
 		Schema::create('settings', function (Blueprint $table) {
16
-            $table->increments('id');
17
-            $table->string('name',100);
18
-            $table->string('key',100)->unique();
19
-            $table->text('value')->nullable();
20
-            $table->softDeletes();
21
-            $table->timestamps();
22
-        });
16
+			$table->increments('id');
17
+			$table->string('name',100);
18
+			$table->string('key',100)->unique();
19
+			$table->text('value')->nullable();
20
+			$table->softDeletes();
21
+			$table->timestamps();
22
+		});
23 23
 	}
24 24
 
25 25
 	/**
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@
 block discarded – undo
12 12
 	 */
13 13
 	public function up()
14 14
 	{
15
-		Schema::create('settings', function (Blueprint $table) {
15
+		Schema::create('settings', function(Blueprint $table) {
16 16
             $table->increments('id');
17
-            $table->string('name',100);
18
-            $table->string('key',100)->unique();
17
+            $table->string('name', 100);
18
+            $table->string('key', 100)->unique();
19 19
             $table->text('value')->nullable();
20 20
             $table->softDeletes();
21 21
             $table->timestamps();
Please login to merge, or discard this patch.
src/Modules/V1/Core/Http/Controllers/SettingsController.php 2 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -8,20 +8,20 @@
 block discarded – undo
8 8
 
9 9
 class SettingsController extends BaseApiController
10 10
 {
11
-    /**
12
-     * The name of the model that is used by the base api controller 
13
-     * to preform actions like (add, edit ... etc).
14
-     * @var string
15
-     */
16
-    protected $model               = 'settings';
11
+	/**
12
+	 * The name of the model that is used by the base api controller 
13
+	 * to preform actions like (add, edit ... etc).
14
+	 * @var string
15
+	 */
16
+	protected $model               = 'settings';
17 17
 
18
-    /**
19
-     * The validations rules used by the base api controller
20
-     * to check before add.
21
-     * @var array
22
-     */
23
-    protected $validationRules  = [
24
-    'name'  => 'required|string|max:100',
25
-    'value' => 'required|string'
26
-    ];
18
+	/**
19
+	 * The validations rules used by the base api controller
20
+	 * to check before add.
21
+	 * @var array
22
+	 */
23
+	protected $validationRules  = [
24
+	'name'  => 'required|string|max:100',
25
+	'value' => 'required|string'
26
+	];
27 27
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,14 +13,14 @@
 block discarded – undo
13 13
      * to preform actions like (add, edit ... etc).
14 14
      * @var string
15 15
      */
16
-    protected $model               = 'settings';
16
+    protected $model = 'settings';
17 17
 
18 18
     /**
19 19
      * The validations rules used by the base api controller
20 20
      * to check before add.
21 21
      * @var array
22 22
      */
23
-    protected $validationRules  = [
23
+    protected $validationRules = [
24 24
     'name'  => 'required|string|max:100',
25 25
     'value' => 'required|string'
26 26
     ];
Please login to merge, or discard this patch.