Completed
Push — master ( 9d10f5...494c34 )
by Sherif
02:26
created
src/Modules/Core/Http/Controllers/BaseApiController.php 1 patch
Indentation   +248 added lines, -248 removed lines patch added patch discarded remove patch
@@ -6,283 +6,283 @@
 block discarded – undo
6 6
 
7 7
 class BaseApiController extends Controller
8 8
 {
9
-    /**
10
-     * The config implementation.
11
-     * 
12
-     * @var array
13
-     */
14
-    protected $config;
9
+	/**
10
+	 * The config implementation.
11
+	 * 
12
+	 * @var array
13
+	 */
14
+	protected $config;
15 15
 
16
-    /**
17
-     * The relations implementation.
18
-     * 
19
-     * @var array
20
-     */
21
-    protected $relations;
16
+	/**
17
+	 * The relations implementation.
18
+	 * 
19
+	 * @var array
20
+	 */
21
+	protected $relations;
22 22
 
23
-    /**
24
-     * The repo implementation.
25
-     * 
26
-     * @var object
27
-     */
28
-    protected $repo;
23
+	/**
24
+	 * The repo implementation.
25
+	 * 
26
+	 * @var object
27
+	 */
28
+	protected $repo;
29 29
 
30
-    public function __construct()
31
-    {        
32
-        $this->config              = \CoreConfig::getConfig();
33
-        $this->model               = property_exists($this, 'model') ? $this->model : false;
34
-        $this->validationRules     = property_exists($this, 'validationRules') ? $this->validationRules : false;
35
-        $this->skipPermissionCheck = property_exists($this, 'skipPermissionCheck') ? $this->skipPermissionCheck : [];
36
-        $this->skipLoginCheck      = property_exists($this, 'skipLoginCheck') ? $this->skipLoginCheck : [];
37
-        $route                     = explode('@',\Route::currentRouteAction())[1];
30
+	public function __construct()
31
+	{        
32
+		$this->config              = \CoreConfig::getConfig();
33
+		$this->model               = property_exists($this, 'model') ? $this->model : false;
34
+		$this->validationRules     = property_exists($this, 'validationRules') ? $this->validationRules : false;
35
+		$this->skipPermissionCheck = property_exists($this, 'skipPermissionCheck') ? $this->skipPermissionCheck : [];
36
+		$this->skipLoginCheck      = property_exists($this, 'skipLoginCheck') ? $this->skipLoginCheck : [];
37
+		$route                     = explode('@',\Route::currentRouteAction())[1];
38 38
 
39
-        $this->middleware(function ($request, $next) {
39
+		$this->middleware(function ($request, $next) {
40 40
             
41
-            $this->repo = call_user_func_array("\Core::{$this->model}", []);            
42
-            return $next($request);
43
-        });
41
+			$this->repo = call_user_func_array("\Core::{$this->model}", []);            
42
+			return $next($request);
43
+		});
44 44
 
45
-        $this->checkPermission($route);
46
-        $this->setRelations($route);
47
-        $this->setSessions();
48
-    }
45
+		$this->checkPermission($route);
46
+		$this->setRelations($route);
47
+		$this->setSessions();
48
+	}
49 49
 
50
-    /**
51
-     * Fetch all records with relations from storage.
52
-     * 
53
-     * @param  string  $sortBy The name of the column to sort by.
54
-     * @param  boolean $desc   Sort ascending or descinding (1: desc, 0: asc).
55
-     * @return \Illuminate\Http\Response
56
-     */
57
-    public function index($sortBy = 'created_at', $desc = 1) 
58
-    {
59
-        return \Response::json($this->repo->all($this->relations, $sortBy, $desc), 200);
60
-    }
50
+	/**
51
+	 * Fetch all records with relations from storage.
52
+	 * 
53
+	 * @param  string  $sortBy The name of the column to sort by.
54
+	 * @param  boolean $desc   Sort ascending or descinding (1: desc, 0: asc).
55
+	 * @return \Illuminate\Http\Response
56
+	 */
57
+	public function index($sortBy = 'created_at', $desc = 1) 
58
+	{
59
+		return \Response::json($this->repo->all($this->relations, $sortBy, $desc), 200);
60
+	}
61 61
 
62
-    /**
63
-     * Fetch the single object with relations from storage.
64
-     * 
65
-     * @param  integer $id Id of the requested model.
66
-     * @return \Illuminate\Http\Response
67
-     */
68
-    public function find($id) 
69
-    {
70
-        return \Response::json($this->repo->find($id, $this->relations), 200);
71
-    }
62
+	/**
63
+	 * Fetch the single object with relations from storage.
64
+	 * 
65
+	 * @param  integer $id Id of the requested model.
66
+	 * @return \Illuminate\Http\Response
67
+	 */
68
+	public function find($id) 
69
+	{
70
+		return \Response::json($this->repo->find($id, $this->relations), 200);
71
+	}
72 72
 
73
-    /**
74
-     * Paginate all records with relations from storage
75
-     * that matche the given query.
76
-     * 
77
-     * @param  string  $query   The search text.
78
-     * @param  integer $perPage Number of rows per page default 15.
79
-     * @param  string  $sortBy  The name of the column to sort by.
80
-     * @param  boolean $desc    Sort ascending or descinding (1: desc, 0: asc).
81
-     * @return \Illuminate\Http\Response
82
-     */
83
-    public function search($query = '', $perPage = 15, $sortBy = 'created_at', $desc = 1) 
84
-    {
85
-        return \Response::json($this->repo->search($query, $perPage, $this->relations, $sortBy, $desc), 200);
86
-    }
73
+	/**
74
+	 * Paginate all records with relations from storage
75
+	 * that matche the given query.
76
+	 * 
77
+	 * @param  string  $query   The search text.
78
+	 * @param  integer $perPage Number of rows per page default 15.
79
+	 * @param  string  $sortBy  The name of the column to sort by.
80
+	 * @param  boolean $desc    Sort ascending or descinding (1: desc, 0: asc).
81
+	 * @return \Illuminate\Http\Response
82
+	 */
83
+	public function search($query = '', $perPage = 15, $sortBy = 'created_at', $desc = 1) 
84
+	{
85
+		return \Response::json($this->repo->search($query, $perPage, $this->relations, $sortBy, $desc), 200);
86
+	}
87 87
 
88
-    /**
89
-     * Fetch records from the storage based on the given
90
-     * condition.
91
-     * 
92
-     * @param  \Illuminate\Http\Request  $request
93
-     * @param  string  $sortBy The name of the column to sort by.
94
-     * @param  boolean $desc   Sort ascending or descinding (1: desc, 0: asc).
95
-     * @return \Illuminate\Http\Response
96
-     */
97
-    public function findby(Request $request, $sortBy = 'created_at', $desc = 1) 
98
-    {
99
-        return \Response::json($this->repo->findBy($request->all(), $this->relations, $sortBy, $desc), 200);
100
-    }
88
+	/**
89
+	 * Fetch records from the storage based on the given
90
+	 * condition.
91
+	 * 
92
+	 * @param  \Illuminate\Http\Request  $request
93
+	 * @param  string  $sortBy The name of the column to sort by.
94
+	 * @param  boolean $desc   Sort ascending or descinding (1: desc, 0: asc).
95
+	 * @return \Illuminate\Http\Response
96
+	 */
97
+	public function findby(Request $request, $sortBy = 'created_at', $desc = 1) 
98
+	{
99
+		return \Response::json($this->repo->findBy($request->all(), $this->relations, $sortBy, $desc), 200);
100
+	}
101 101
 
102
-    /**
103
-     * Fetch the first record from the storage based on the given
104
-     * condition.
105
-     * 
106
-     * @param  \Illuminate\Http\Request  $request
107
-     * @return \Illuminate\Http\Response
108
-     */
109
-    public function first(Request $request) 
110
-    {
111
-        return \Response::json($this->repo->first($request->all(), $this->relations), 200);
112
-    }
102
+	/**
103
+	 * Fetch the first record from the storage based on the given
104
+	 * condition.
105
+	 * 
106
+	 * @param  \Illuminate\Http\Request  $request
107
+	 * @return \Illuminate\Http\Response
108
+	 */
109
+	public function first(Request $request) 
110
+	{
111
+		return \Response::json($this->repo->first($request->all(), $this->relations), 200);
112
+	}
113 113
 
114
-    /**
115
-     * Paginate all records with relations from storage.
116
-     * 
117
-     * @param  integer $perPage Number of rows per page default 15.
118
-     * @param  string  $sortBy  The name of the column to sort by.
119
-     * @param  boolean $desc    Sort ascending or descinding (1: desc, 0: asc).
120
-     * @return \Illuminate\Http\Response
121
-     */
122
-    public function paginate($perPage = 15, $sortBy = 'created_at', $desc = 1) 
123
-    {
124
-        return \Response::json($this->repo->paginate($perPage, $this->relations, $sortBy, $desc), 200);
125
-    }
114
+	/**
115
+	 * Paginate all records with relations from storage.
116
+	 * 
117
+	 * @param  integer $perPage Number of rows per page default 15.
118
+	 * @param  string  $sortBy  The name of the column to sort by.
119
+	 * @param  boolean $desc    Sort ascending or descinding (1: desc, 0: asc).
120
+	 * @return \Illuminate\Http\Response
121
+	 */
122
+	public function paginate($perPage = 15, $sortBy = 'created_at', $desc = 1) 
123
+	{
124
+		return \Response::json($this->repo->paginate($perPage, $this->relations, $sortBy, $desc), 200);
125
+	}
126 126
 
127
-    /**
128
-     * Fetch all records with relations based on
129
-     * the given condition from storage in pages.
130
-     * 
131
-     * @param  \Illuminate\Http\Request  $request
132
-     * @param  integer $perPage Number of rows per page default 15.
133
-     * @param  string  $sortBy  The name of the column to sort by.
134
-     * @param  boolean $desc    Sort ascending or descinding (1: desc, 0: asc).
135
-     * @return \Illuminate\Http\Response
136
-     */
137
-    public function paginateby(Request $request, $perPage = 15, $sortBy = 'created_at', $desc = 1) 
138
-    {
139
-        return \Response::json($this->repo->paginateBy($request->all(), $perPage, $this->relations, $sortBy, $desc), 200);
140
-    }
127
+	/**
128
+	 * Fetch all records with relations based on
129
+	 * the given condition from storage in pages.
130
+	 * 
131
+	 * @param  \Illuminate\Http\Request  $request
132
+	 * @param  integer $perPage Number of rows per page default 15.
133
+	 * @param  string  $sortBy  The name of the column to sort by.
134
+	 * @param  boolean $desc    Sort ascending or descinding (1: desc, 0: asc).
135
+	 * @return \Illuminate\Http\Response
136
+	 */
137
+	public function paginateby(Request $request, $perPage = 15, $sortBy = 'created_at', $desc = 1) 
138
+	{
139
+		return \Response::json($this->repo->paginateBy($request->all(), $perPage, $this->relations, $sortBy, $desc), 200);
140
+	}
141 141
 
142
-    /**
143
-     * Save the given model to storage.
144
-     * 
145
-     * @param  \Illuminate\Http\Request  $request
146
-     * @return \Illuminate\Http\Response
147
-     */
148
-    public function save(Request $request) 
149
-    {
150
-        foreach ($this->validationRules as &$rule) 
151
-        {
152
-            if (strpos($rule, 'exists') && ! strpos($rule, 'deleted_at,NULL')) 
153
-            {
154
-                $rule .= ',deleted_at,NULL';
155
-            }
142
+	/**
143
+	 * Save the given model to storage.
144
+	 * 
145
+	 * @param  \Illuminate\Http\Request  $request
146
+	 * @return \Illuminate\Http\Response
147
+	 */
148
+	public function save(Request $request) 
149
+	{
150
+		foreach ($this->validationRules as &$rule) 
151
+		{
152
+			if (strpos($rule, 'exists') && ! strpos($rule, 'deleted_at,NULL')) 
153
+			{
154
+				$rule .= ',deleted_at,NULL';
155
+			}
156 156
 
157
-            if ($request->has('id')) 
158
-            {
159
-                $rule = str_replace('{id}', $request->get('id'), $rule);
160
-            }
161
-            else
162
-            {
163
-                $rule = str_replace(',{id}', '', $rule);
164
-            }
165
-        }
157
+			if ($request->has('id')) 
158
+			{
159
+				$rule = str_replace('{id}', $request->get('id'), $rule);
160
+			}
161
+			else
162
+			{
163
+				$rule = str_replace(',{id}', '', $rule);
164
+			}
165
+		}
166 166
         
167
-        $this->validate($request, $this->validationRules);
167
+		$this->validate($request, $this->validationRules);
168 168
 
169
-        return \Response::json($this->repo->save($request->all()), 200);
170
-    }
169
+		return \Response::json($this->repo->save($request->all()), 200);
170
+	}
171 171
 
172
-    /**
173
-     * Delete by the given id from storage.
174
-     * 
175
-     * @param  integer $id Id of the deleted model.
176
-     * @return \Illuminate\Http\Response
177
-     */
178
-    public function delete($id) 
179
-    {
180
-        return \Response::json($this->repo->delete($id), 200);
181
-    }
172
+	/**
173
+	 * Delete by the given id from storage.
174
+	 * 
175
+	 * @param  integer $id Id of the deleted model.
176
+	 * @return \Illuminate\Http\Response
177
+	 */
178
+	public function delete($id) 
179
+	{
180
+		return \Response::json($this->repo->delete($id), 200);
181
+	}
182 182
 
183
-    /**
184
-     * Return the deleted models in pages based on the given conditions.
185
-     *
186
-     * @param  \Illuminate\Http\Request  $request
187
-     * @param  integer $perPage Number of rows per page default 15.
188
-     * @param  string  $sortBy  The name of the column to sort by.
189
-     * @param  boolean $desc    Sort ascending or descinding (1: desc, 0: asc).
190
-     * @return \Illuminate\Http\Response
191
-     */
192
-    public function deleted(Request $request, $perPage = 15, $sortBy = 'created_at', $desc = 1) 
193
-    {
194
-        return \Response::json($this->repo->deleted($request->all(), $perPage, $sortBy, $desc), 200);
195
-    }
183
+	/**
184
+	 * Return the deleted models in pages based on the given conditions.
185
+	 *
186
+	 * @param  \Illuminate\Http\Request  $request
187
+	 * @param  integer $perPage Number of rows per page default 15.
188
+	 * @param  string  $sortBy  The name of the column to sort by.
189
+	 * @param  boolean $desc    Sort ascending or descinding (1: desc, 0: asc).
190
+	 * @return \Illuminate\Http\Response
191
+	 */
192
+	public function deleted(Request $request, $perPage = 15, $sortBy = 'created_at', $desc = 1) 
193
+	{
194
+		return \Response::json($this->repo->deleted($request->all(), $perPage, $sortBy, $desc), 200);
195
+	}
196 196
 
197
-    /**
198
-     * Restore the deleted model.
199
-     * 
200
-     * @param  integer $id Id of the restored model.
201
-     * @return \Illuminate\Http\Response
202
-     */
203
-    public function restore($id) 
204
-    {
205
-        return \Response::json($this->repo->restore($id), 200);
206
-    }
197
+	/**
198
+	 * Restore the deleted model.
199
+	 * 
200
+	 * @param  integer $id Id of the restored model.
201
+	 * @return \Illuminate\Http\Response
202
+	 */
203
+	public function restore($id) 
204
+	{
205
+		return \Response::json($this->repo->restore($id), 200);
206
+	}
207 207
 
208
-    /**
209
-     * Check if the logged in user can do the given permission.
210
-     * 
211
-     * @param  string $permission
212
-     * @return void
213
-     */
214
-    private function checkPermission($permission)
215
-    {   
216
-        \Auth::shouldUse('api');
217
-        $this->middleware('auth:api', ['except' => $this->skipLoginCheck]);
208
+	/**
209
+	 * Check if the logged in user can do the given permission.
210
+	 * 
211
+	 * @param  string $permission
212
+	 * @return void
213
+	 */
214
+	private function checkPermission($permission)
215
+	{   
216
+		\Auth::shouldUse('api');
217
+		$this->middleware('auth:api', ['except' => $this->skipLoginCheck]);
218 218
         
219
-        if (\Auth::user() && ! in_array($permission, $this->skipLoginCheck))
220
-        {
221
-            $user             = \Auth::user();
222
-            $permission       = $permission !== 'index' ? $permission : 'list';
223
-            $isPasswordClient = $user->token()->client->password_client;
219
+		if (\Auth::user() && ! in_array($permission, $this->skipLoginCheck))
220
+		{
221
+			$user             = \Auth::user();
222
+			$permission       = $permission !== 'index' ? $permission : 'list';
223
+			$isPasswordClient = $user->token()->client->password_client;
224 224
 
225
-            if ($user->blocked)
226
-            {
227
-                \ErrorHandler::userIsBlocked();
228
-            }
225
+			if ($user->blocked)
226
+			{
227
+				\ErrorHandler::userIsBlocked();
228
+			}
229 229
 
230
-            if ($isPasswordClient && (in_array($permission, $this->skipPermissionCheck) || \Core::users()->can($permission, $this->model)))
231
-            {}
232
-            elseif ( ! $isPasswordClient && $user->tokenCan($this->model . '-' . $permission)) 
233
-            {}
234
-            else
235
-            {
230
+			if ($isPasswordClient && (in_array($permission, $this->skipPermissionCheck) || \Core::users()->can($permission, $this->model)))
231
+			{}
232
+			elseif ( ! $isPasswordClient && $user->tokenCan($this->model . '-' . $permission)) 
233
+			{}
234
+			else
235
+			{
236 236
 
237
-                \ErrorHandler::noPermissions();
238
-            }
239
-        }
240
-    }
237
+				\ErrorHandler::noPermissions();
238
+			}
239
+		}
240
+	}
241 241
 
242
-    /**
243
-     * Set sessions based on the given headers in the request.
244
-     * 
245
-     * @return void
246
-     */
247
-    private function setSessions()
248
-    {
249
-        \Session::put('time-zone', \Request::header('time-zone') ?: 0);
242
+	/**
243
+	 * Set sessions based on the given headers in the request.
244
+	 * 
245
+	 * @return void
246
+	 */
247
+	private function setSessions()
248
+	{
249
+		\Session::put('time-zone', \Request::header('time-zone') ?: 0);
250 250
 
251
-        $locale = \Request::header('locale');
252
-        switch ($locale) 
253
-        {
254
-            case 'en':
255
-            \App::setLocale('en');
256
-            \Session::put('locale', 'en');
257
-            break;
251
+		$locale = \Request::header('locale');
252
+		switch ($locale) 
253
+		{
254
+			case 'en':
255
+			\App::setLocale('en');
256
+			\Session::put('locale', 'en');
257
+			break;
258 258
 
259
-            case 'ar':
260
-            \App::setLocale('ar');
261
-            \Session::put('locale', 'ar');
262
-            break;
259
+			case 'ar':
260
+			\App::setLocale('ar');
261
+			\Session::put('locale', 'ar');
262
+			break;
263 263
 
264
-            case 'all':
265
-            \App::setLocale('en');
266
-            \Session::put('locale', 'all');
267
-            break;
264
+			case 'all':
265
+			\App::setLocale('en');
266
+			\Session::put('locale', 'all');
267
+			break;
268 268
 
269
-            default:
270
-            \App::setLocale('en');
271
-            \Session::put('locale', 'en');
272
-            break;
273
-        }
274
-    }
269
+			default:
270
+			\App::setLocale('en');
271
+			\Session::put('locale', 'en');
272
+			break;
273
+		}
274
+	}
275 275
 
276
-    /**
277
-     * Set relation based on the called api.
278
-     * 
279
-     * @param  string $route
280
-     * @return void
281
-     */
282
-    private function setRelations($route)
283
-    {
284
-        $route           = $route !== 'index' ? $route : 'list';
285
-        $relations       = array_key_exists($this->model, $this->config['relations']) ? $this->config['relations'][$this->model] : false;
286
-        $this->relations = $relations && isset($relations[$route]) ? $relations[$route] : [];
287
-    }
276
+	/**
277
+	 * Set relation based on the called api.
278
+	 * 
279
+	 * @param  string $route
280
+	 * @return void
281
+	 */
282
+	private function setRelations($route)
283
+	{
284
+		$route           = $route !== 'index' ? $route : 'list';
285
+		$relations       = array_key_exists($this->model, $this->config['relations']) ? $this->config['relations'][$this->model] : false;
286
+		$this->relations = $relations && isset($relations[$route]) ? $relations[$route] : [];
287
+	}
288 288
 }
Please login to merge, or discard this patch.
src/Modules/Core/Console/Commands/GenerateDoc.php 1 patch
Indentation   +243 added lines, -243 removed lines patch added patch discarded remove patch
@@ -6,275 +6,275 @@
 block discarded – undo
6 6
 
7 7
 class GenerateDoc extends Command
8 8
 {
9
-    /**
10
-     * The name and signature of the console command.
11
-     *
12
-     * @var string
13
-     */
14
-    protected $signature = 'doc:generate';
9
+	/**
10
+	 * The name and signature of the console command.
11
+	 *
12
+	 * @var string
13
+	 */
14
+	protected $signature = 'doc:generate';
15 15
 
16
-    /**
17
-     * The console command description.
18
-     *
19
-     * @var string
20
-     */
21
-    protected $description = 'Generate api documentation';
16
+	/**
17
+	 * The console command description.
18
+	 *
19
+	 * @var string
20
+	 */
21
+	protected $description = 'Generate api documentation';
22 22
 
23
-    /**
24
-     * Create a new command instance.
25
-     *
26
-     * @return void
27
-     */
28
-    public function __construct()
29
-    {
30
-        parent::__construct();
31
-    }
23
+	/**
24
+	 * Create a new command instance.
25
+	 *
26
+	 * @return void
27
+	 */
28
+	public function __construct()
29
+	{
30
+		parent::__construct();
31
+	}
32 32
 
33
-    /**
34
-     * Execute the console command.
35
-     *
36
-     * @return mixed
37
-     */
38
-    public function handle()
39
-    {
40
-        $docData           = [];
41
-        $docData['models'] = [];
42
-        $routes            = $this->getRoutes();
43
-        foreach ($routes as $route) 
44
-        {
45
-            if ($route) 
46
-            {
47
-                $actoinArray = explode('@', $route['action']);
48
-                if(array_get($actoinArray, 1, false))
49
-                {
50
-                    $controller       = $actoinArray[0];
51
-                    $method           = $actoinArray[1];
52
-                    $route['name']    = $method !== 'index' ? $method : 'list';
33
+	/**
34
+	 * Execute the console command.
35
+	 *
36
+	 * @return mixed
37
+	 */
38
+	public function handle()
39
+	{
40
+		$docData           = [];
41
+		$docData['models'] = [];
42
+		$routes            = $this->getRoutes();
43
+		foreach ($routes as $route) 
44
+		{
45
+			if ($route) 
46
+			{
47
+				$actoinArray = explode('@', $route['action']);
48
+				if(array_get($actoinArray, 1, false))
49
+				{
50
+					$controller       = $actoinArray[0];
51
+					$method           = $actoinArray[1];
52
+					$route['name']    = $method !== 'index' ? $method : 'list';
53 53
                     
54
-                    $reflectionClass  = new \ReflectionClass($controller);
55
-                    $reflectionMethod = $reflectionClass->getMethod($method);
56
-                    $classProperties  = $reflectionClass->getDefaultProperties();
57
-                    $skipLoginCheck   = array_key_exists('skipLoginCheck', $classProperties) ? $classProperties['skipLoginCheck'] : false;
58
-                    $validationRules  = array_key_exists('validationRules', $classProperties) ? $classProperties['validationRules'] : false;
54
+					$reflectionClass  = new \ReflectionClass($controller);
55
+					$reflectionMethod = $reflectionClass->getMethod($method);
56
+					$classProperties  = $reflectionClass->getDefaultProperties();
57
+					$skipLoginCheck   = array_key_exists('skipLoginCheck', $classProperties) ? $classProperties['skipLoginCheck'] : false;
58
+					$validationRules  = array_key_exists('validationRules', $classProperties) ? $classProperties['validationRules'] : false;
59 59
 
60
-                    $this->processDocBlock($route, $reflectionMethod);
61
-                    $this->getHeaders($route, $method, $skipLoginCheck);
62
-                    $this->getPostData($route, $reflectionMethod, $validationRules);
60
+					$this->processDocBlock($route, $reflectionMethod);
61
+					$this->getHeaders($route, $method, $skipLoginCheck);
62
+					$this->getPostData($route, $reflectionMethod, $validationRules);
63 63
 
64
-                    $route['response'] = $this->getResponseObject($classProperties['model'], $route['name'], $route['returnDocBlock']);
64
+					$route['response'] = $this->getResponseObject($classProperties['model'], $route['name'], $route['returnDocBlock']);
65 65
 
66
-                    preg_match('/api\/([^#]+)\//iU', $route['uri'], $module);
67
-                    $docData['modules'][$module[1]][substr($route['prefix'], strlen('/api/' . $module[1] . '/') - 1)][] = $route;
66
+					preg_match('/api\/([^#]+)\//iU', $route['uri'], $module);
67
+					$docData['modules'][$module[1]][substr($route['prefix'], strlen('/api/' . $module[1] . '/') - 1)][] = $route;
68 68
 
69
-                    $this->getModels($classProperties['model'], $docData);   
70
-                }
71
-            }
72
-        }
69
+					$this->getModels($classProperties['model'], $docData);   
70
+				}
71
+			}
72
+		}
73 73
         
74
-        $docData['errors'] = $this->getErrors();
75
-        \File::put(app_path('Modules/Core/Resources/api.json'), json_encode($docData));
76
-    }
74
+		$docData['errors'] = $this->getErrors();
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
-            {
88
-                return [
89
-                    'method' => $route->methods()[0],
90
-                    'uri'    => $route->uri(),
91
-                    'action' => $route->getActionName(),
92
-                    'prefix' => $route->getPrefix()
93
-                ];
94
-            }
95
-            return false;
96
-        })->all();
97
-    }
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
+			{
88
+				return [
89
+					'method' => $route->methods()[0],
90
+					'uri'    => $route->uri(),
91
+					'action' => $route->getActionName(),
92
+					'prefix' => $route->getPrefix()
93
+				];
94
+			}
95
+			return false;
96
+		})->all();
97
+	}
98 98
 
99
-    /**
100
-     * Generate headers for the given route.
101
-     * 
102
-     * @param  array  &$route
103
-     * @param  string $method
104
-     * @param  array  $skipLoginCheck
105
-     * @return void
106
-     */
107
-    protected function getHeaders(&$route, $method, $skipLoginCheck)
108
-    {
109
-        $route['headers'] = [
110
-        'Accept'       => 'application/json',
111
-        'Content-Type' => 'application/json',
112
-        'locale'       => 'The language of the returned data: ar, en or all.',
113
-        'time-zone'    => 'Your locale time zone',
114
-        ];
99
+	/**
100
+	 * Generate headers for the given route.
101
+	 * 
102
+	 * @param  array  &$route
103
+	 * @param  string $method
104
+	 * @param  array  $skipLoginCheck
105
+	 * @return void
106
+	 */
107
+	protected function getHeaders(&$route, $method, $skipLoginCheck)
108
+	{
109
+		$route['headers'] = [
110
+		'Accept'       => 'application/json',
111
+		'Content-Type' => 'application/json',
112
+		'locale'       => 'The language of the returned data: ar, en or all.',
113
+		'time-zone'    => 'Your locale time zone',
114
+		];
115 115
 
116 116
 
117
-        if (! $skipLoginCheck || ! in_array($method, $skipLoginCheck)) 
118
-        {
119
-            $route['headers']['Authorization'] = 'Bearer {token}';
120
-        }
121
-    }
117
+		if (! $skipLoginCheck || ! in_array($method, $skipLoginCheck)) 
118
+		{
119
+			$route['headers']['Authorization'] = 'Bearer {token}';
120
+		}
121
+	}
122 122
 
123
-    /**
124
-     * Generate description and params for the given route
125
-     * based on the docblock.
126
-     * 
127
-     * @param  array  &$route
128
-     * @param  object $reflectionMethod]
129
-     * @return void
130
-     */
131
-    protected function processDocBlock(&$route, $reflectionMethod)
132
-    {
133
-        $factory                 = \phpDocumentor\Reflection\DocBlockFactory::createInstance();
134
-        $docblock                = $factory->create($reflectionMethod->getDocComment());
135
-        $route['description']    = trim(preg_replace('/\s+/', ' ', $docblock->getSummary()));
136
-        $params                  = $docblock->getTagsByName('param');
137
-        $route['returnDocBlock'] = $docblock->getTagsByName('return')[0]->getType()->getFqsen()->getName();
138
-        foreach ($params as $param) 
139
-        {
140
-            $name = $param->getVariableName();
141
-            if ($name !== 'request') 
142
-            {
143
-                $route['parametars'][$param->getVariableName()] = $param->getDescription()->render();
144
-            }
145
-        }
146
-    }
123
+	/**
124
+	 * Generate description and params for the given route
125
+	 * based on the docblock.
126
+	 * 
127
+	 * @param  array  &$route
128
+	 * @param  object $reflectionMethod]
129
+	 * @return void
130
+	 */
131
+	protected function processDocBlock(&$route, $reflectionMethod)
132
+	{
133
+		$factory                 = \phpDocumentor\Reflection\DocBlockFactory::createInstance();
134
+		$docblock                = $factory->create($reflectionMethod->getDocComment());
135
+		$route['description']    = trim(preg_replace('/\s+/', ' ', $docblock->getSummary()));
136
+		$params                  = $docblock->getTagsByName('param');
137
+		$route['returnDocBlock'] = $docblock->getTagsByName('return')[0]->getType()->getFqsen()->getName();
138
+		foreach ($params as $param) 
139
+		{
140
+			$name = $param->getVariableName();
141
+			if ($name !== 'request') 
142
+			{
143
+				$route['parametars'][$param->getVariableName()] = $param->getDescription()->render();
144
+			}
145
+		}
146
+	}
147 147
 
148
-    /**
149
-     * Generate post body for the given route.
150
-     * 
151
-     * @param  array  &$route
152
-     * @param  object $reflectionMethod
153
-     * @param  array  $validationRules
154
-     * @return void
155
-     */
156
-    protected function getPostData(&$route, $reflectionMethod, $validationRules)
157
-    {
158
-        if ($route['method'] == 'POST') 
159
-        {
160
-            $body = $this->getMethodBody($reflectionMethod);
148
+	/**
149
+	 * Generate post body for the given route.
150
+	 * 
151
+	 * @param  array  &$route
152
+	 * @param  object $reflectionMethod
153
+	 * @param  array  $validationRules
154
+	 * @return void
155
+	 */
156
+	protected function getPostData(&$route, $reflectionMethod, $validationRules)
157
+	{
158
+		if ($route['method'] == 'POST') 
159
+		{
160
+			$body = $this->getMethodBody($reflectionMethod);
161 161
 
162
-            preg_match('/\$this->validate\(\$request,([^#]+)\);/iU', $body, $match);
163
-            if (count($match)) 
164
-            {
165
-                if ($match[1] == '$this->validationRules')
166
-                {
167
-                    $route['body'] = $validationRules;
168
-                }
169
-                else
170
-                {
171
-                    $route['body'] = eval('return ' . str_replace(',\'.$request->get(\'id\')', ',{id}\'', $match[1]) . ';');
172
-                }
162
+			preg_match('/\$this->validate\(\$request,([^#]+)\);/iU', $body, $match);
163
+			if (count($match)) 
164
+			{
165
+				if ($match[1] == '$this->validationRules')
166
+				{
167
+					$route['body'] = $validationRules;
168
+				}
169
+				else
170
+				{
171
+					$route['body'] = eval('return ' . str_replace(',\'.$request->get(\'id\')', ',{id}\'', $match[1]) . ';');
172
+				}
173 173
 
174
-                foreach ($route['body'] as &$rule) 
175
-                {
176
-                    if(strpos($rule, 'unique'))
177
-                    {
178
-                        $rule = substr($rule, 0, strpos($rule, 'unique') + 6);
179
-                    }
180
-                    elseif(strpos($rule, 'exists'))
181
-                    {
182
-                        $rule = substr($rule, 0, strpos($rule, 'exists') - 1);
183
-                    }
184
-                }
185
-            }
186
-            else
187
-            {
188
-                $route['body'] = 'conditions';
189
-            }
190
-        }
191
-    }
174
+				foreach ($route['body'] as &$rule) 
175
+				{
176
+					if(strpos($rule, 'unique'))
177
+					{
178
+						$rule = substr($rule, 0, strpos($rule, 'unique') + 6);
179
+					}
180
+					elseif(strpos($rule, 'exists'))
181
+					{
182
+						$rule = substr($rule, 0, strpos($rule, 'exists') - 1);
183
+					}
184
+				}
185
+			}
186
+			else
187
+			{
188
+				$route['body'] = 'conditions';
189
+			}
190
+		}
191
+	}
192 192
 
193
-    /**
194
-     * Generate application errors.
195
-     * 
196
-     * @return array
197
-     */
198
-    protected function getErrors()
199
-    {
200
-        $errors          = [];
201
-        $reflectionClass = new \ReflectionClass('App\Modules\Core\Utl\ErrorHandler');
202
-        foreach ($reflectionClass->getMethods() as $method) 
203
-        {
204
-            $methodName       = $method->getName();
205
-            $reflectionMethod = $reflectionClass->getMethod($methodName);
206
-            $body             = $this->getMethodBody($reflectionMethod);
193
+	/**
194
+	 * Generate application errors.
195
+	 * 
196
+	 * @return array
197
+	 */
198
+	protected function getErrors()
199
+	{
200
+		$errors          = [];
201
+		$reflectionClass = new \ReflectionClass('App\Modules\Core\Utl\ErrorHandler');
202
+		foreach ($reflectionClass->getMethods() as $method) 
203
+		{
204
+			$methodName       = $method->getName();
205
+			$reflectionMethod = $reflectionClass->getMethod($methodName);
206
+			$body             = $this->getMethodBody($reflectionMethod);
207 207
 
208
-            preg_match('/\$error=\[\'status\'=>([^#]+)\,/iU', $body, $match);
208
+			preg_match('/\$error=\[\'status\'=>([^#]+)\,/iU', $body, $match);
209 209
 
210
-            if (count($match)) 
211
-            {
212
-                $errors[$match[1]][] = $methodName;
213
-            }
214
-        }
210
+			if (count($match)) 
211
+			{
212
+				$errors[$match[1]][] = $methodName;
213
+			}
214
+		}
215 215
 
216
-        return $errors;
217
-    }
216
+		return $errors;
217
+	}
218 218
 
219
-    /**
220
-     * Get the given method body code.
221
-     * 
222
-     * @param  object $reflectionMethod
223
-     * @return string
224
-     */
225
-    protected function getMethodBody($reflectionMethod)
226
-    {
227
-        $filename   = $reflectionMethod->getFileName();
228
-        $start_line = $reflectionMethod->getStartLine() - 1;
229
-        $end_line   = $reflectionMethod->getEndLine();
230
-        $length     = $end_line - $start_line;         
231
-        $source     = file($filename);
232
-        $body       = implode("", array_slice($source, $start_line, $length));
233
-        $body       = trim(preg_replace('/\s+/', '', $body));
219
+	/**
220
+	 * Get the given method body code.
221
+	 * 
222
+	 * @param  object $reflectionMethod
223
+	 * @return string
224
+	 */
225
+	protected function getMethodBody($reflectionMethod)
226
+	{
227
+		$filename   = $reflectionMethod->getFileName();
228
+		$start_line = $reflectionMethod->getStartLine() - 1;
229
+		$end_line   = $reflectionMethod->getEndLine();
230
+		$length     = $end_line - $start_line;         
231
+		$source     = file($filename);
232
+		$body       = implode("", array_slice($source, $start_line, $length));
233
+		$body       = trim(preg_replace('/\s+/', '', $body));
234 234
 
235
-        return $body;
236
-    }
235
+		return $body;
236
+	}
237 237
 
238
-    /**
239
-     * Get example object of all availble models.
240
-     * 
241
-     * @param  string $modelName
242
-     * @param  array  $docData
243
-     * @return string
244
-     */
245
-    protected function getModels($modelName, &$docData)
246
-    {
247
-        if ($modelName && ! array_key_exists($modelName, $docData['models'])) 
248
-        {
249
-            $modelClass = call_user_func_array("\Core::{$modelName}", [])->modelClass;
250
-            $model      = factory($modelClass)->make();
251
-            $modelArr   = $model->toArray();
238
+	/**
239
+	 * Get example object of all availble models.
240
+	 * 
241
+	 * @param  string $modelName
242
+	 * @param  array  $docData
243
+	 * @return string
244
+	 */
245
+	protected function getModels($modelName, &$docData)
246
+	{
247
+		if ($modelName && ! array_key_exists($modelName, $docData['models'])) 
248
+		{
249
+			$modelClass = call_user_func_array("\Core::{$modelName}", [])->modelClass;
250
+			$model      = factory($modelClass)->make();
251
+			$modelArr   = $model->toArray();
252 252
 
253
-            if ( $model->trans && ! $model->trans->count()) 
254
-            {
255
-                $modelArr['trans'] = [
256
-                    'en' => factory($modelClass . 'Translation')->make()->toArray()
257
-                ];
258
-            }
253
+			if ( $model->trans && ! $model->trans->count()) 
254
+			{
255
+				$modelArr['trans'] = [
256
+					'en' => factory($modelClass . 'Translation')->make()->toArray()
257
+				];
258
+			}
259 259
 
260
-            $docData['models'][$modelName] = json_encode($modelArr, JSON_PRETTY_PRINT);
261
-        }
262
-    }
260
+			$docData['models'][$modelName] = json_encode($modelArr, JSON_PRETTY_PRINT);
261
+		}
262
+	}
263 263
 
264
-    /**
265
-     * Get the route response object type.
266
-     * 
267
-     * @param  string $modelName
268
-     * @param  string $method
269
-     * @param  string $returnDocBlock
270
-     * @return array
271
-     */
272
-    protected function getResponseObject($modelName, $method, $returnDocBlock)
273
-    {
274
-        $config    = \CoreConfig::getConfig();
275
-        $relations = array_key_exists($modelName, $config['relations']) ? array_key_exists($method, $config['relations'][$modelName]) ? $config['relations'][$modelName] : false : false;
276
-        $modelName = call_user_func_array("\Core::{$returnDocBlock}", []) ? $returnDocBlock : $modelName;
264
+	/**
265
+	 * Get the route response object type.
266
+	 * 
267
+	 * @param  string $modelName
268
+	 * @param  string $method
269
+	 * @param  string $returnDocBlock
270
+	 * @return array
271
+	 */
272
+	protected function getResponseObject($modelName, $method, $returnDocBlock)
273
+	{
274
+		$config    = \CoreConfig::getConfig();
275
+		$relations = array_key_exists($modelName, $config['relations']) ? array_key_exists($method, $config['relations'][$modelName]) ? $config['relations'][$modelName] : false : false;
276
+		$modelName = call_user_func_array("\Core::{$returnDocBlock}", []) ? $returnDocBlock : $modelName;
277 277
 
278
-        return $relations ? [$modelName => $relations && $relations[$method] ? $relations[$method] : []] : false;
279
-    }
278
+		return $relations ? [$modelName => $relations && $relations[$method] ? $relations[$method] : []] : false;
279
+	}
280 280
 }
Please login to merge, or discard this patch.
lang/en/validation.php 1 patch
Indentation   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 return [
4 4
 
5
-    /*
5
+	/*
6 6
     |--------------------------------------------------------------------------
7 7
     | Validation Language Lines
8 8
     |--------------------------------------------------------------------------
@@ -13,74 +13,74 @@  discard block
 block discarded – undo
13 13
     |
14 14
     */
15 15
 
16
-    'accepted'             => 'The :attribute must be accepted.',
17
-    'active_url'           => 'The :attribute is not a valid URL.',
18
-    'after'                => 'The :attribute must be a date after :date.',
19
-    'alpha'                => 'The :attribute may only contain letters.',
20
-    'alpha_dash'           => 'The :attribute may only contain letters, numbers, and dashes.',
21
-    'alpha_num'            => 'The :attribute may only contain letters and numbers.',
22
-    'array'                => 'The :attribute must be an array.',
23
-    'before'               => 'The :attribute must be a date before :date.',
24
-    'between'              => [
25
-        'numeric' => 'The :attribute must be between :min and :max.',
26
-        'file'    => 'The :attribute must be between :min and :max kilobytes.',
27
-        'string'  => 'The :attribute must be between :min and :max characters.',
28
-        'array'   => 'The :attribute must have between :min and :max items.',
29
-    ],
30
-    'boolean'              => 'The :attribute field must be true or false.',
31
-    'confirmed'            => 'The :attribute confirmation does not match.',
32
-    'date'                 => 'The :attribute is not a valid date.',
33
-    'date_format'          => 'The :attribute does not match the format :format.',
34
-    'different'            => 'The :attribute and :other must be different.',
35
-    'digits'               => 'The :attribute must be :digits digits.',
36
-    'digits_between'       => 'The :attribute must be between :min and :max digits.',
37
-    'distinct'             => 'The :attribute field has a duplicate value.',
38
-    'email'                => 'The :attribute must be a valid email address.',
39
-    'exists'               => 'The selected :attribute is invalid.',
40
-    'filled'               => 'The :attribute field is required.',
41
-    'image'                => 'The :attribute must be an image.',
42
-    'in'                   => 'The selected :attribute is invalid.',
43
-    'in_array'             => 'The :attribute field does not exist in :other.',
44
-    'integer'              => 'The :attribute must be an integer.',
45
-    'ip'                   => 'The :attribute must be a valid IP address.',
46
-    'json'                 => 'The :attribute must be a valid JSON string.',
47
-    'max'                  => [
48
-        'numeric' => 'The :attribute may not be greater than :max.',
49
-        'file'    => 'The :attribute may not be greater than :max kilobytes.',
50
-        'string'  => 'The :attribute may not be greater than :max characters.',
51
-        'array'   => 'The :attribute may not have more than :max items.',
52
-    ],
53
-    'mimes'                => 'The :attribute must be a file of type: :values.',
54
-    'min'                  => [
55
-        'numeric' => 'The :attribute must be at least :min.',
56
-        'file'    => 'The :attribute must be at least :min kilobytes.',
57
-        'string'  => 'The :attribute must be at least :min characters.',
58
-        'array'   => 'The :attribute must have at least :min items.',
59
-    ],
60
-    'not_in'               => 'The selected :attribute is invalid.',
61
-    'numeric'              => 'The :attribute must be a number.',
62
-    'present'              => 'The :attribute field must be present.',
63
-    'regex'                => 'The :attribute format is invalid.',
64
-    'required'             => 'The :attribute field is required.',
65
-    'required_if'          => 'The :attribute field is required when :other is :value.',
66
-    'required_unless'      => 'The :attribute field is required unless :other is in :values.',
67
-    'required_with'        => 'The :attribute field is required when :values is present.',
68
-    'required_with_all'    => 'The :attribute field is required when :values is present.',
69
-    'required_without'     => 'The :attribute field is required when :values is not present.',
70
-    'required_without_all' => 'The :attribute field is required when none of :values are present.',
71
-    'same'                 => 'The :attribute and :other must match.',
72
-    'size'                 => [
73
-        'numeric' => 'The :attribute must be :size.',
74
-        'file'    => 'The :attribute must be :size kilobytes.',
75
-        'string'  => 'The :attribute must be :size characters.',
76
-        'array'   => 'The :attribute must contain :size items.',
77
-    ],
78
-    'string'               => 'The :attribute must be a string.',
79
-    'timezone'             => 'The :attribute must be a valid zone.',
80
-    'unique'               => 'The :attribute has already been taken.',
81
-    'url'                  => 'The :attribute format is invalid.',
16
+	'accepted'             => 'The :attribute must be accepted.',
17
+	'active_url'           => 'The :attribute is not a valid URL.',
18
+	'after'                => 'The :attribute must be a date after :date.',
19
+	'alpha'                => 'The :attribute may only contain letters.',
20
+	'alpha_dash'           => 'The :attribute may only contain letters, numbers, and dashes.',
21
+	'alpha_num'            => 'The :attribute may only contain letters and numbers.',
22
+	'array'                => 'The :attribute must be an array.',
23
+	'before'               => 'The :attribute must be a date before :date.',
24
+	'between'              => [
25
+		'numeric' => 'The :attribute must be between :min and :max.',
26
+		'file'    => 'The :attribute must be between :min and :max kilobytes.',
27
+		'string'  => 'The :attribute must be between :min and :max characters.',
28
+		'array'   => 'The :attribute must have between :min and :max items.',
29
+	],
30
+	'boolean'              => 'The :attribute field must be true or false.',
31
+	'confirmed'            => 'The :attribute confirmation does not match.',
32
+	'date'                 => 'The :attribute is not a valid date.',
33
+	'date_format'          => 'The :attribute does not match the format :format.',
34
+	'different'            => 'The :attribute and :other must be different.',
35
+	'digits'               => 'The :attribute must be :digits digits.',
36
+	'digits_between'       => 'The :attribute must be between :min and :max digits.',
37
+	'distinct'             => 'The :attribute field has a duplicate value.',
38
+	'email'                => 'The :attribute must be a valid email address.',
39
+	'exists'               => 'The selected :attribute is invalid.',
40
+	'filled'               => 'The :attribute field is required.',
41
+	'image'                => 'The :attribute must be an image.',
42
+	'in'                   => 'The selected :attribute is invalid.',
43
+	'in_array'             => 'The :attribute field does not exist in :other.',
44
+	'integer'              => 'The :attribute must be an integer.',
45
+	'ip'                   => 'The :attribute must be a valid IP address.',
46
+	'json'                 => 'The :attribute must be a valid JSON string.',
47
+	'max'                  => [
48
+		'numeric' => 'The :attribute may not be greater than :max.',
49
+		'file'    => 'The :attribute may not be greater than :max kilobytes.',
50
+		'string'  => 'The :attribute may not be greater than :max characters.',
51
+		'array'   => 'The :attribute may not have more than :max items.',
52
+	],
53
+	'mimes'                => 'The :attribute must be a file of type: :values.',
54
+	'min'                  => [
55
+		'numeric' => 'The :attribute must be at least :min.',
56
+		'file'    => 'The :attribute must be at least :min kilobytes.',
57
+		'string'  => 'The :attribute must be at least :min characters.',
58
+		'array'   => 'The :attribute must have at least :min items.',
59
+	],
60
+	'not_in'               => 'The selected :attribute is invalid.',
61
+	'numeric'              => 'The :attribute must be a number.',
62
+	'present'              => 'The :attribute field must be present.',
63
+	'regex'                => 'The :attribute format is invalid.',
64
+	'required'             => 'The :attribute field is required.',
65
+	'required_if'          => 'The :attribute field is required when :other is :value.',
66
+	'required_unless'      => 'The :attribute field is required unless :other is in :values.',
67
+	'required_with'        => 'The :attribute field is required when :values is present.',
68
+	'required_with_all'    => 'The :attribute field is required when :values is present.',
69
+	'required_without'     => 'The :attribute field is required when :values is not present.',
70
+	'required_without_all' => 'The :attribute field is required when none of :values are present.',
71
+	'same'                 => 'The :attribute and :other must match.',
72
+	'size'                 => [
73
+		'numeric' => 'The :attribute must be :size.',
74
+		'file'    => 'The :attribute must be :size kilobytes.',
75
+		'string'  => 'The :attribute must be :size characters.',
76
+		'array'   => 'The :attribute must contain :size items.',
77
+	],
78
+	'string'               => 'The :attribute must be a string.',
79
+	'timezone'             => 'The :attribute must be a valid zone.',
80
+	'unique'               => 'The :attribute has already been taken.',
81
+	'url'                  => 'The :attribute format is invalid.',
82 82
 
83
-    /*
83
+	/*
84 84
     |--------------------------------------------------------------------------
85 85
     | Custom Validation Language Lines
86 86
     |--------------------------------------------------------------------------
@@ -91,13 +91,13 @@  discard block
 block discarded – undo
91 91
     |
92 92
     */
93 93
 
94
-    'custom' => [
95
-        'attribute-name' => [
96
-            'rule-name' => 'custom-message',
97
-        ],
98
-    ],
94
+	'custom' => [
95
+		'attribute-name' => [
96
+			'rule-name' => 'custom-message',
97
+		],
98
+	],
99 99
 
100
-    /*
100
+	/*
101 101
     |--------------------------------------------------------------------------
102 102
     | Custom Validation Attributes
103 103
     |--------------------------------------------------------------------------
@@ -108,6 +108,6 @@  discard block
 block discarded – undo
108 108
     |
109 109
     */
110 110
 
111
-    'attributes' => [],
111
+	'attributes' => [],
112 112
 
113 113
 ];
Please login to merge, or discard this patch.
lang/en/pagination.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 return [
4 4
 
5
-    /*
5
+	/*
6 6
     |--------------------------------------------------------------------------
7 7
     | Pagination Language Lines
8 8
     |--------------------------------------------------------------------------
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
     |
14 14
     */
15 15
 
16
-    'previous' => '« Previous',
17
-    'next'     => 'Next »',
16
+	'previous' => '« Previous',
17
+	'next'     => 'Next »',
18 18
 
19 19
 ];
Please login to merge, or discard this patch.
lang/en/auth.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 return [
4 4
 
5
-    /*
5
+	/*
6 6
     |--------------------------------------------------------------------------
7 7
     | Authentication Language Lines
8 8
     |--------------------------------------------------------------------------
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
     |
14 14
     */
15 15
 
16
-    'failed' => 'These credentials do not match our records.',
17
-    'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
16
+	'failed' => 'These credentials do not match our records.',
17
+	'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
18 18
 
19 19
 ];
Please login to merge, or discard this patch.
lang/en/passwords.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 return [
4 4
 
5
-    /*
5
+	/*
6 6
     |--------------------------------------------------------------------------
7 7
     | Password Reset Language Lines
8 8
     |--------------------------------------------------------------------------
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
     |
14 14
     */
15 15
 
16
-    'password' => 'Passwords must be at least six characters and match the confirmation.',
17
-    'reset' => 'Your password has been reset!',
18
-    'sent' => 'We have e-mailed your password reset link!',
19
-    'token' => 'This password reset token is invalid.',
20
-    'user' => "We can't find a user with that e-mail address.",
16
+	'password' => 'Passwords must be at least six characters and match the confirmation.',
17
+	'reset' => 'Your password has been reset!',
18
+	'sent' => 'We have e-mailed your password reset link!',
19
+	'token' => 'This password reset token is invalid.',
20
+	'user' => "We can't find a user with that e-mail address.",
21 21
 
22 22
 ];
Please login to merge, or discard this patch.
lang/ar/validation.php 1 patch
Indentation   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 return [
4 4
 
5
-    /*
5
+	/*
6 6
     |--------------------------------------------------------------------------
7 7
     | Validation Language Lines
8 8
     |--------------------------------------------------------------------------
@@ -13,76 +13,76 @@  discard block
 block discarded – undo
13 13
     |
14 14
     */
15 15
 
16
-    'accepted'             => 'يجب قبول الحقل :attribute',
17
-    'active_url'           => 'الحقل :attribute لا يُمثّل رابطًا صحيحًا',
18
-    'after'                => 'يجب على الحقل :attribute أن يكون تاريخًا لاحقًا للتاريخ :date.',
19
-    'alpha'                => 'يجب أن لا يحتوي الحقل :attribute سوى على حروف',
20
-    'alpha_dash'           => 'يجب أن لا يحتوي الحقل :attribute على حروف، أرقام ومطّات.',
21
-    'alpha_num'            => 'يجب أن يحتوي :attribute على حروفٍ وأرقامٍ فقط',
22
-    'array'                => 'يجب أن يكون الحقل :attribute ًمصفوفة',
23
-    'before'               => 'يجب على الحقل :attribute أن يكون تاريخًا سابقًا للتاريخ :date.',
24
-    'between'              => [
25
-        'numeric' => 'يجب أن تكون قيمة :attribute محصورة ما بين :min و :max.',
26
-        'file'    => 'يجب أن يكون حجم الملف :attribute محصورًا ما بين :min و :max كيلوبايت.',
27
-        'string'  => 'يجب أن يكون عدد حروف النّص :attribute محصورًا ما بين :min و :max',
28
-        'array'   => 'يجب أن يحتوي :attribute على عدد من العناصر محصورًا ما بين :min و :max',
29
-    ],
30
-    'boolean'              => 'يجب أن تكون قيمة الحقل :attribute إما true أو false ',
31
-    'confirmed'            => 'حقل التأكيد غير مُطابق للحقل :attribute',
32
-    'date'                 => 'الحقل :attribute ليس تاريخًا صحيحًا',
33
-    'date_format'          => 'لا يتوافق الحقل :attribute مع الشكل :format.',
34
-    'different'            => 'يجب أن يكون الحقلان :attribute و :other مُختلفان',
35
-    'digits'               => 'يجب أن يحتوي الحقل :attribute على :digits رقمًا/أرقام',
36
-    'digits_between'       => 'يجب أن يحتوي الحقل :attribute ما بين :min و :max رقمًا/أرقام ',
37
-    'dimensions'           => 'The :attribute has invalid image dimensions.',
38
-    'distinct'             => 'للحقل :attribute قيمة مُكرّرة.',
39
-    'email'                => 'يجب أن يكون :attribute عنوان بريد إلكتروني صحيح البُنية',
40
-    'exists'               => 'الحقل :attribute لاغٍ',
41
-    'file'                 => 'The :attribute must be a file.',
42
-    'filled'               => 'الحقل :attribute إجباري',
43
-    'image'                => 'يجب أن يكون الحقل :attribute صورةً',
44
-    'in'                   => 'الحقل :attribute لاغٍ',
45
-    'in_array'             => 'الحقل :attribute غير موجود في :other.',
46
-    'integer'              => 'يجب أن يكون الحقل :attribute عددًا صحيحًا',
47
-    'ip'                   => 'يجب أن يكون الحقل :attribute عنوان IP ذي بُنية صحيحة',
48
-    'json'                 => 'يجب أن يكون الحقل :attribute نصآ من نوع JSON.',
49
-    'max'                  => [
50
-        'numeric' => 'يجب أن تكون قيمة الحقل :attribute أصغر من :max.',
51
-        'file'    => 'يجب أن يكون حجم الملف :attribute أصغر من :max كيلوبايت',
52
-        'string'  => 'يجب أن لا يتجاوز طول النّص :attribute :max حروفٍ/حرفًا',
53
-        'array'   => 'يجب أن لا يحتوي الحقل :attribute على أكثر من :max عناصر/عنصر.',
54
-    ],
55
-    'mimes'                => 'يجب أن يكون الحقل ملفًا من نوع : :values.',
56
-    'min'                  => [
57
-        'numeric' => 'يجب أن تكون قيمة الحقل :attribute أكبر من :min.',
58
-        'file'    => 'يجب أن يكون حجم الملف :attribute أكبر من :min كيلوبايت',
59
-        'string'  => 'يجب أن يكون طول النص :attribute أكبر من :min حروفٍ/حرفًا',
60
-        'array'   => 'يجب أن يحتوي الحقل :attribute على الأقل على :min عُنصرًا/عناصر',
61
-    ],
62
-    'not_in'               => 'الحقل :attribute لاغٍ',
63
-    'numeric'              => 'يجب على الحقل :attribute أن يكون رقمًا',
64
-    'present'              => 'The :attribute field must be present.',
65
-    'regex'                => 'صيغة الحقل :attribute .غير صحيحة',
66
-    'required'             => 'الحقل :attribute مطلوب.',
67
-    'required_if'          => 'الحقل :attribute مطلوب في حال ما إذا كان :other يساوي :value.',
68
-    'required_unless'      => 'الحقل :attribute مطلوب في حال ما لم يكن :other يساوي :values.',
69
-    'required_with'        => 'الحقل :attribute إذا توفّر :values.',
70
-    'required_with_all'    => 'الحقل :attribute إذا توفّر :values.',
71
-    'required_without'     => 'الحقل :attribute إذا لم يتوفّر :values.',
72
-    'required_without_all' => 'الحقل :attribute إذا لم يتوفّر :values.',
73
-    'same'                 => 'يجب أن يتطابق الحقل :attribute مع :other',
74
-    'size'                 => [
75
-        'numeric' => 'يجب أن تكون قيمة :attribute أكبر من :size.',
76
-        'file'    => 'يجب أن يكون حجم الملف :attribute أكبر من :size كيلو بايت.',
77
-        'string'  => 'يجب أن يحتوي النص :attribute عن ما لا يقل عن  :size حرفٍ/أحرف.',
78
-        'array'   => 'يجب أن يحتوي الحقل :attribute عن ما لا يقل عن:min عنصرٍ/عناصر',
79
-    ],
80
-    'string'               => 'يجب أن يكون الحقل :attribute نصآ.',
81
-    'timezone'             => 'يجب أن يكون :attribute نطاقًا زمنيًا صحيحًا',
82
-    'unique'               => 'قيمة الحقل :attribute مُستخدمة من قبل',
83
-    'url'                  => 'صيغة الرابط :attribute غير صحيحة',
16
+	'accepted'             => 'يجب قبول الحقل :attribute',
17
+	'active_url'           => 'الحقل :attribute لا يُمثّل رابطًا صحيحًا',
18
+	'after'                => 'يجب على الحقل :attribute أن يكون تاريخًا لاحقًا للتاريخ :date.',
19
+	'alpha'                => 'يجب أن لا يحتوي الحقل :attribute سوى على حروف',
20
+	'alpha_dash'           => 'يجب أن لا يحتوي الحقل :attribute على حروف، أرقام ومطّات.',
21
+	'alpha_num'            => 'يجب أن يحتوي :attribute على حروفٍ وأرقامٍ فقط',
22
+	'array'                => 'يجب أن يكون الحقل :attribute ًمصفوفة',
23
+	'before'               => 'يجب على الحقل :attribute أن يكون تاريخًا سابقًا للتاريخ :date.',
24
+	'between'              => [
25
+		'numeric' => 'يجب أن تكون قيمة :attribute محصورة ما بين :min و :max.',
26
+		'file'    => 'يجب أن يكون حجم الملف :attribute محصورًا ما بين :min و :max كيلوبايت.',
27
+		'string'  => 'يجب أن يكون عدد حروف النّص :attribute محصورًا ما بين :min و :max',
28
+		'array'   => 'يجب أن يحتوي :attribute على عدد من العناصر محصورًا ما بين :min و :max',
29
+	],
30
+	'boolean'              => 'يجب أن تكون قيمة الحقل :attribute إما true أو false ',
31
+	'confirmed'            => 'حقل التأكيد غير مُطابق للحقل :attribute',
32
+	'date'                 => 'الحقل :attribute ليس تاريخًا صحيحًا',
33
+	'date_format'          => 'لا يتوافق الحقل :attribute مع الشكل :format.',
34
+	'different'            => 'يجب أن يكون الحقلان :attribute و :other مُختلفان',
35
+	'digits'               => 'يجب أن يحتوي الحقل :attribute على :digits رقمًا/أرقام',
36
+	'digits_between'       => 'يجب أن يحتوي الحقل :attribute ما بين :min و :max رقمًا/أرقام ',
37
+	'dimensions'           => 'The :attribute has invalid image dimensions.',
38
+	'distinct'             => 'للحقل :attribute قيمة مُكرّرة.',
39
+	'email'                => 'يجب أن يكون :attribute عنوان بريد إلكتروني صحيح البُنية',
40
+	'exists'               => 'الحقل :attribute لاغٍ',
41
+	'file'                 => 'The :attribute must be a file.',
42
+	'filled'               => 'الحقل :attribute إجباري',
43
+	'image'                => 'يجب أن يكون الحقل :attribute صورةً',
44
+	'in'                   => 'الحقل :attribute لاغٍ',
45
+	'in_array'             => 'الحقل :attribute غير موجود في :other.',
46
+	'integer'              => 'يجب أن يكون الحقل :attribute عددًا صحيحًا',
47
+	'ip'                   => 'يجب أن يكون الحقل :attribute عنوان IP ذي بُنية صحيحة',
48
+	'json'                 => 'يجب أن يكون الحقل :attribute نصآ من نوع JSON.',
49
+	'max'                  => [
50
+		'numeric' => 'يجب أن تكون قيمة الحقل :attribute أصغر من :max.',
51
+		'file'    => 'يجب أن يكون حجم الملف :attribute أصغر من :max كيلوبايت',
52
+		'string'  => 'يجب أن لا يتجاوز طول النّص :attribute :max حروفٍ/حرفًا',
53
+		'array'   => 'يجب أن لا يحتوي الحقل :attribute على أكثر من :max عناصر/عنصر.',
54
+	],
55
+	'mimes'                => 'يجب أن يكون الحقل ملفًا من نوع : :values.',
56
+	'min'                  => [
57
+		'numeric' => 'يجب أن تكون قيمة الحقل :attribute أكبر من :min.',
58
+		'file'    => 'يجب أن يكون حجم الملف :attribute أكبر من :min كيلوبايت',
59
+		'string'  => 'يجب أن يكون طول النص :attribute أكبر من :min حروفٍ/حرفًا',
60
+		'array'   => 'يجب أن يحتوي الحقل :attribute على الأقل على :min عُنصرًا/عناصر',
61
+	],
62
+	'not_in'               => 'الحقل :attribute لاغٍ',
63
+	'numeric'              => 'يجب على الحقل :attribute أن يكون رقمًا',
64
+	'present'              => 'The :attribute field must be present.',
65
+	'regex'                => 'صيغة الحقل :attribute .غير صحيحة',
66
+	'required'             => 'الحقل :attribute مطلوب.',
67
+	'required_if'          => 'الحقل :attribute مطلوب في حال ما إذا كان :other يساوي :value.',
68
+	'required_unless'      => 'الحقل :attribute مطلوب في حال ما لم يكن :other يساوي :values.',
69
+	'required_with'        => 'الحقل :attribute إذا توفّر :values.',
70
+	'required_with_all'    => 'الحقل :attribute إذا توفّر :values.',
71
+	'required_without'     => 'الحقل :attribute إذا لم يتوفّر :values.',
72
+	'required_without_all' => 'الحقل :attribute إذا لم يتوفّر :values.',
73
+	'same'                 => 'يجب أن يتطابق الحقل :attribute مع :other',
74
+	'size'                 => [
75
+		'numeric' => 'يجب أن تكون قيمة :attribute أكبر من :size.',
76
+		'file'    => 'يجب أن يكون حجم الملف :attribute أكبر من :size كيلو بايت.',
77
+		'string'  => 'يجب أن يحتوي النص :attribute عن ما لا يقل عن  :size حرفٍ/أحرف.',
78
+		'array'   => 'يجب أن يحتوي الحقل :attribute عن ما لا يقل عن:min عنصرٍ/عناصر',
79
+	],
80
+	'string'               => 'يجب أن يكون الحقل :attribute نصآ.',
81
+	'timezone'             => 'يجب أن يكون :attribute نطاقًا زمنيًا صحيحًا',
82
+	'unique'               => 'قيمة الحقل :attribute مُستخدمة من قبل',
83
+	'url'                  => 'صيغة الرابط :attribute غير صحيحة',
84 84
 
85
-    /*
85
+	/*
86 86
     |--------------------------------------------------------------------------
87 87
     | Custom Validation Language Lines
88 88
     |--------------------------------------------------------------------------
@@ -93,13 +93,13 @@  discard block
 block discarded – undo
93 93
     |
94 94
     */
95 95
 
96
-    'custom'               => [
97
-        'attribute-name' => [
98
-            'rule-name' => 'custom-message',
99
-        ],
100
-    ],
96
+	'custom'               => [
97
+		'attribute-name' => [
98
+			'rule-name' => 'custom-message',
99
+		],
100
+	],
101 101
 
102
-    /*
102
+	/*
103 103
     |--------------------------------------------------------------------------
104 104
     | Custom Validation Attributes
105 105
     |--------------------------------------------------------------------------
@@ -110,36 +110,36 @@  discard block
 block discarded – undo
110 110
     |
111 111
     */
112 112
 
113
-    'attributes'           => [
114
-        'name'                  => 'الاسم',
115
-        'username'              => 'اسم المُستخدم',
116
-        'email'                 => 'البريد الالكتروني',
117
-        'first_name'            => 'الاسم',
118
-        'last_name'             => 'اسم العائلة',
119
-        'password'              => 'كلمة السر',
120
-        'password_confirmation' => 'تأكيد كلمة السر',
121
-        'city'                  => 'المدينة',
122
-        'country'               => 'الدولة',
123
-        'address'               => 'العنوان',
124
-        'phone'                 => 'الهاتف',
125
-        'mobile'                => 'الجوال',
126
-        'age'                   => 'العمر',
127
-        'sex'                   => 'الجنس',
128
-        'gender'                => 'النوع',
129
-        'day'                   => 'اليوم',
130
-        'month'                 => 'الشهر',
131
-        'year'                  => 'السنة',
132
-        'hour'                  => 'ساعة',
133
-        'minute'                => 'دقيقة',
134
-        'second'                => 'ثانية',
135
-        'title'                 => 'اللقب',
136
-        'content'               => 'المُحتوى',
137
-        'description'           => 'الوصف',
138
-        'excerpt'               => 'المُلخص',
139
-        'date'                  => 'التاريخ',
140
-        'time'                  => 'الوقت',
141
-        'available'             => 'مُتاح',
142
-        'size'                  => 'الحجم',
143
-    ],
113
+	'attributes'           => [
114
+		'name'                  => 'الاسم',
115
+		'username'              => 'اسم المُستخدم',
116
+		'email'                 => 'البريد الالكتروني',
117
+		'first_name'            => 'الاسم',
118
+		'last_name'             => 'اسم العائلة',
119
+		'password'              => 'كلمة السر',
120
+		'password_confirmation' => 'تأكيد كلمة السر',
121
+		'city'                  => 'المدينة',
122
+		'country'               => 'الدولة',
123
+		'address'               => 'العنوان',
124
+		'phone'                 => 'الهاتف',
125
+		'mobile'                => 'الجوال',
126
+		'age'                   => 'العمر',
127
+		'sex'                   => 'الجنس',
128
+		'gender'                => 'النوع',
129
+		'day'                   => 'اليوم',
130
+		'month'                 => 'الشهر',
131
+		'year'                  => 'السنة',
132
+		'hour'                  => 'ساعة',
133
+		'minute'                => 'دقيقة',
134
+		'second'                => 'ثانية',
135
+		'title'                 => 'اللقب',
136
+		'content'               => 'المُحتوى',
137
+		'description'           => 'الوصف',
138
+		'excerpt'               => 'المُلخص',
139
+		'date'                  => 'التاريخ',
140
+		'time'                  => 'الوقت',
141
+		'available'             => 'مُتاح',
142
+		'size'                  => 'الحجم',
143
+	],
144 144
 
145 145
 ];
Please login to merge, or discard this patch.
lang/ar/pagination.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 return [
4 4
 
5
-    /*
5
+	/*
6 6
     |--------------------------------------------------------------------------
7 7
     | Pagination Language Lines
8 8
     |--------------------------------------------------------------------------
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
     |
14 14
     */
15 15
 
16
-    'previous' => '« السابق',
17
-    'next'     => 'التالي »',
16
+	'previous' => '« السابق',
17
+	'next'     => 'التالي »',
18 18
 
19 19
 ];
Please login to merge, or discard this patch.
lang/ar/auth.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 return [
4 4
 
5
-    /*
5
+	/*
6 6
     |--------------------------------------------------------------------------
7 7
     | Authentication Language Lines
8 8
     |--------------------------------------------------------------------------
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
     |
14 14
     */
15 15
 
16
-    'failed'   => 'بيانات الاعتماد هذه غير متطابقة مع البيانات المسجلة لدينا.',
17
-    'throttle' => 'عدد كبير جدا من محاولات الدخول. يرجى المحاولة مرة أخرى بعد :seconds ثانية.',
16
+	'failed'   => 'بيانات الاعتماد هذه غير متطابقة مع البيانات المسجلة لدينا.',
17
+	'throttle' => 'عدد كبير جدا من محاولات الدخول. يرجى المحاولة مرة أخرى بعد :seconds ثانية.',
18 18
 
19 19
 ];
Please login to merge, or discard this patch.