Completed
Push — master ( 262a61...e9fbf8 )
by Sherif
02:59
created
src/Modules/V1/Core/Http/Controllers/LogsController.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -8,9 +8,9 @@
 block discarded – undo
8 8
 class LogsController extends BaseApiController
9 9
 {
10 10
 	/**
11
-     * The name of the model that is used by the base api controller 
12
-     * to preform actions like (add, edit ... etc).
13
-     * @var string
14
-     */
15
-    protected $model            = 'logs';
11
+	 * The name of the model that is used by the base api controller 
12
+	 * to preform actions like (add, edit ... etc).
13
+	 * @var string
14
+	 */
15
+	protected $model            = 'logs';
16 16
 }
Please login to merge, or discard this patch.
src/Modules/V1/Core/Http/Controllers/SettingsController.php 1 patch
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|max:100'
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|max:100'
26
+	];
27 27
 }
Please login to merge, or discard this patch.
src/Modules/V1/Core/Http/Controllers/BaseApiController.php 1 patch
Indentation   +215 added lines, -215 removed lines patch added patch discarded remove patch
@@ -6,221 +6,221 @@
 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;
15
-
16
-    /**
17
-     * The config implementation.
18
-     * 
19
-     * @var config
20
-     */
21
-    protected $config;
22
-
23
-    public function __construct()
24
-    {
25
-        \Session::set('timeZoneDiff', \Request::header('time-zone-diff') ?: 0);
9
+	/**
10
+	 * The model implementation.
11
+	 * 
12
+	 * @var model
13
+	 */
14
+	protected $model;
15
+
16
+	/**
17
+	 * The config implementation.
18
+	 * 
19
+	 * @var config
20
+	 */
21
+	protected $config;
22
+
23
+	public function __construct()
24
+	{
25
+		\Session::set('timeZoneDiff', \Request::header('time-zone-diff') ?: 0);
26 26
         
27
-        $this->config              = \CoreConfig::getConfig();
28
-        $this->model               = property_exists($this, 'model') ? $this->model : false;
29
-        $this->validationRules     = property_exists($this, 'validationRules') ? $this->validationRules : false;
30
-        $this->skipPermissionCheck = property_exists($this, 'skipPermissionCheck') ? $this->skipPermissionCheck : [];
31
-        $this->skipLoginCheck      = property_exists($this, 'skipLoginCheck') ? $this->skipLoginCheck : [];
32
-        $this->relations           = array_key_exists($this->model, $this->config['relations']) ? $this->config['relations'][$this->model] : false;
33
-        $route                     = explode('@',\Route::currentRouteAction())[1];
34
-        $this->checkPermission(explode('_', snake_case($route))[1]);
35
-    }
36
-
37
-    /**
38
-     * Fetch all records with relations from model repository.
39
-     * 
40
-     * @param  string  $sortBy
41
-     * @param  boolean $desc
42
-     * @return \Illuminate\Http\Response
43
-     */
44
-    public function getIndex() 
45
-    {
46
-        if ($this->model)
47
-        {
48
-            $relations = $this->relations && $this->relations['all'] ? $this->relations['all'] : [];
49
-            return \Response::json(call_user_func_array("\Core::{$this->model}", [])->all($relations), 200);
50
-        }
51
-    }
52
-
53
-    /**
54
-     * Fetch the single object with relations from model repository.
55
-     * 
56
-     * @param  integer $id
57
-     * @return \Illuminate\Http\Response
58
-     */
59
-    public function getFind($id) 
60
-    {
61
-        if ($this->model) 
62
-        {
63
-            $relations = $this->relations && $this->relations['find'] ? $this->relations['find'] : [];
64
-            return \Response::json(call_user_func_array("\Core::{$this->model}", [])->find($id, $relations), 200);
65
-        }
66
-    }
67
-
68
-    /**
69
-     * Paginate all records with relations from model repository
70
-     * that matche the given query.
71
-     * 
72
-     * @param  string  $query
73
-     * @param  integer $perPage
74
-     * @param  string  $sortBy
75
-     * @param  boolean $desc
76
-     * @return \Illuminate\Http\Response
77
-     */
78
-    public function getSearch($query = '', $perPage = 15, $sortBy = 'created_at', $desc = 1) 
79
-    {
80
-        if ($this->model) 
81
-        {
82
-            $relations = $this->relations && $this->relations['paginate'] ? $this->relations['paginate'] : [];
83
-            return \Response::json(call_user_func_array("\Core::{$this->model}", [])->search($query, $perPage, $relations, $sortBy, $desc), 200);
84
-        }
85
-    }
86
-
87
-    /**
88
-     * Fetch records from the storage based on the given
89
-     * condition.
90
-     * 
91
-     * @param  \Illuminate\Http\Request  $request
92
-     * @param  string  $sortBy
93
-     * @param  boolean $desc
94
-     * @return \Illuminate\Http\Response
95
-     */
96
-    public function postFindby(Request $request, $sortBy = 'created_at', $desc = 1) 
97
-    {
98
-        if ($this->model) 
99
-        {
100
-            $relations = $this->relations && $this->relations['findBy'] ? $this->relations['findBy'] : [];
101
-            return \Response::json(call_user_func_array("\Core::{$this->model}", [])->findBy($request->all(), $relations, $sortBy, $desc), 200);
102
-        }
103
-    }
104
-
105
-    /**
106
-     * Fetch the first record from the storage based on the given
107
-     * condition.
108
-     * 
109
-     * @param  \Illuminate\Http\Request  $request
110
-     * @return \Illuminate\Http\Response
111
-     */
112
-    public function postFirst(Request $request) 
113
-    {
114
-        if ($this->model) 
115
-        {
116
-            $relations = $this->relations && $this->relations['first'] ? $this->relations['first'] : [];
117
-            return \Response::json(call_user_func_array("\Core::{$this->model}", [])->first($request->all(), $relations), 200);
118
-        }
119
-    }
120
-
121
-    /**
122
-     * Paginate all records with relations from model repository.
123
-     * 
124
-     * @param  integer $perPage
125
-     * @param  string  $sortBy
126
-     * @param  boolean $desc
127
-     * @return \Illuminate\Http\Response
128
-     */
129
-    public function getPaginate($perPage = 15, $sortBy = 'created_at', $desc = 1) 
130
-    {
131
-        if ($this->model) 
132
-        {
133
-            $relations = $this->relations && $this->relations['paginate'] ? $this->relations['paginate'] : [];
134
-            return \Response::json(call_user_func_array("\Core::{$this->model}", [])->paginate($perPage, $relations, $sortBy, $desc), 200);
135
-        }
136
-    }
137
-
138
-    /**
139
-     * Fetch all records with relations based on
140
-     * the given condition from storage in pages.
141
-     * 
142
-     * @param  \Illuminate\Http\Request  $request
143
-     * @param  integer $perPage
144
-     * @param  string  $sortBy
145
-     * @param  boolean $desc
146
-     * @return \Illuminate\Http\Response
147
-     */
148
-    public function postPaginateby(Request $request, $perPage = 15, $sortBy = 'created_at', $desc = 1) 
149
-    {
150
-        if ($this->model) 
151
-        {
152
-            $relations = $this->relations && $this->relations['paginateBy'] ? $this->relations['paginateBy'] : [];
153
-            return \Response::json(call_user_func_array("\Core::{$this->model}", [])->paginateBy($request->all(), $perPage, $relations, $sortBy, $desc), 200);
154
-        }
155
-    }
156
-
157
-    /**
158
-     * Save the given model to repository.
159
-     * 
160
-     * @param  \Illuminate\Http\Request  $request
161
-     * @return \Illuminate\Http\Response
162
-     */
163
-    public function postSave(Request $request) 
164
-    {
165
-        foreach ($this->validationRules as &$rule) 
166
-        {
167
-            if (strpos($rule, 'exists') && ! strpos($rule, 'deleted_at,NULL')) 
168
-            {
169
-                $rule .= ',deleted_at,NULL';
170
-            }
171
-
172
-            if ($request->has('id')) 
173
-            {
174
-                $rule = str_replace('{id}', $request->get('id'), $rule);
175
-            }
176
-            else
177
-            {
178
-                $rule = str_replace(',{id}', '', $rule);
179
-            }
180
-        }
27
+		$this->config              = \CoreConfig::getConfig();
28
+		$this->model               = property_exists($this, 'model') ? $this->model : false;
29
+		$this->validationRules     = property_exists($this, 'validationRules') ? $this->validationRules : false;
30
+		$this->skipPermissionCheck = property_exists($this, 'skipPermissionCheck') ? $this->skipPermissionCheck : [];
31
+		$this->skipLoginCheck      = property_exists($this, 'skipLoginCheck') ? $this->skipLoginCheck : [];
32
+		$this->relations           = array_key_exists($this->model, $this->config['relations']) ? $this->config['relations'][$this->model] : false;
33
+		$route                     = explode('@',\Route::currentRouteAction())[1];
34
+		$this->checkPermission(explode('_', snake_case($route))[1]);
35
+	}
36
+
37
+	/**
38
+	 * Fetch all records with relations from model repository.
39
+	 * 
40
+	 * @param  string  $sortBy
41
+	 * @param  boolean $desc
42
+	 * @return \Illuminate\Http\Response
43
+	 */
44
+	public function getIndex() 
45
+	{
46
+		if ($this->model)
47
+		{
48
+			$relations = $this->relations && $this->relations['all'] ? $this->relations['all'] : [];
49
+			return \Response::json(call_user_func_array("\Core::{$this->model}", [])->all($relations), 200);
50
+		}
51
+	}
52
+
53
+	/**
54
+	 * Fetch the single object with relations from model repository.
55
+	 * 
56
+	 * @param  integer $id
57
+	 * @return \Illuminate\Http\Response
58
+	 */
59
+	public function getFind($id) 
60
+	{
61
+		if ($this->model) 
62
+		{
63
+			$relations = $this->relations && $this->relations['find'] ? $this->relations['find'] : [];
64
+			return \Response::json(call_user_func_array("\Core::{$this->model}", [])->find($id, $relations), 200);
65
+		}
66
+	}
67
+
68
+	/**
69
+	 * Paginate all records with relations from model repository
70
+	 * that matche the given query.
71
+	 * 
72
+	 * @param  string  $query
73
+	 * @param  integer $perPage
74
+	 * @param  string  $sortBy
75
+	 * @param  boolean $desc
76
+	 * @return \Illuminate\Http\Response
77
+	 */
78
+	public function getSearch($query = '', $perPage = 15, $sortBy = 'created_at', $desc = 1) 
79
+	{
80
+		if ($this->model) 
81
+		{
82
+			$relations = $this->relations && $this->relations['paginate'] ? $this->relations['paginate'] : [];
83
+			return \Response::json(call_user_func_array("\Core::{$this->model}", [])->search($query, $perPage, $relations, $sortBy, $desc), 200);
84
+		}
85
+	}
86
+
87
+	/**
88
+	 * Fetch records from the storage based on the given
89
+	 * condition.
90
+	 * 
91
+	 * @param  \Illuminate\Http\Request  $request
92
+	 * @param  string  $sortBy
93
+	 * @param  boolean $desc
94
+	 * @return \Illuminate\Http\Response
95
+	 */
96
+	public function postFindby(Request $request, $sortBy = 'created_at', $desc = 1) 
97
+	{
98
+		if ($this->model) 
99
+		{
100
+			$relations = $this->relations && $this->relations['findBy'] ? $this->relations['findBy'] : [];
101
+			return \Response::json(call_user_func_array("\Core::{$this->model}", [])->findBy($request->all(), $relations, $sortBy, $desc), 200);
102
+		}
103
+	}
104
+
105
+	/**
106
+	 * Fetch the first record from the storage based on the given
107
+	 * condition.
108
+	 * 
109
+	 * @param  \Illuminate\Http\Request  $request
110
+	 * @return \Illuminate\Http\Response
111
+	 */
112
+	public function postFirst(Request $request) 
113
+	{
114
+		if ($this->model) 
115
+		{
116
+			$relations = $this->relations && $this->relations['first'] ? $this->relations['first'] : [];
117
+			return \Response::json(call_user_func_array("\Core::{$this->model}", [])->first($request->all(), $relations), 200);
118
+		}
119
+	}
120
+
121
+	/**
122
+	 * Paginate all records with relations from model repository.
123
+	 * 
124
+	 * @param  integer $perPage
125
+	 * @param  string  $sortBy
126
+	 * @param  boolean $desc
127
+	 * @return \Illuminate\Http\Response
128
+	 */
129
+	public function getPaginate($perPage = 15, $sortBy = 'created_at', $desc = 1) 
130
+	{
131
+		if ($this->model) 
132
+		{
133
+			$relations = $this->relations && $this->relations['paginate'] ? $this->relations['paginate'] : [];
134
+			return \Response::json(call_user_func_array("\Core::{$this->model}", [])->paginate($perPage, $relations, $sortBy, $desc), 200);
135
+		}
136
+	}
137
+
138
+	/**
139
+	 * Fetch all records with relations based on
140
+	 * the given condition from storage in pages.
141
+	 * 
142
+	 * @param  \Illuminate\Http\Request  $request
143
+	 * @param  integer $perPage
144
+	 * @param  string  $sortBy
145
+	 * @param  boolean $desc
146
+	 * @return \Illuminate\Http\Response
147
+	 */
148
+	public function postPaginateby(Request $request, $perPage = 15, $sortBy = 'created_at', $desc = 1) 
149
+	{
150
+		if ($this->model) 
151
+		{
152
+			$relations = $this->relations && $this->relations['paginateBy'] ? $this->relations['paginateBy'] : [];
153
+			return \Response::json(call_user_func_array("\Core::{$this->model}", [])->paginateBy($request->all(), $perPage, $relations, $sortBy, $desc), 200);
154
+		}
155
+	}
156
+
157
+	/**
158
+	 * Save the given model to repository.
159
+	 * 
160
+	 * @param  \Illuminate\Http\Request  $request
161
+	 * @return \Illuminate\Http\Response
162
+	 */
163
+	public function postSave(Request $request) 
164
+	{
165
+		foreach ($this->validationRules as &$rule) 
166
+		{
167
+			if (strpos($rule, 'exists') && ! strpos($rule, 'deleted_at,NULL')) 
168
+			{
169
+				$rule .= ',deleted_at,NULL';
170
+			}
171
+
172
+			if ($request->has('id')) 
173
+			{
174
+				$rule = str_replace('{id}', $request->get('id'), $rule);
175
+			}
176
+			else
177
+			{
178
+				$rule = str_replace(',{id}', '', $rule);
179
+			}
180
+		}
181 181
         
182
-        $this->validate($request, $this->validationRules);
183
-
184
-        if ($this->model) 
185
-        {
186
-            return \Response::json(call_user_func_array("\Core::{$this->model}", [])->save($request->all()), 200);
187
-        }
188
-    }
189
-
190
-    /**
191
-     * Delete by the given id from model repository.
192
-     * 
193
-     * @param  integer  $id
194
-     * @return \Illuminate\Http\Response
195
-     */
196
-    public function getDelete($id) 
197
-    {
198
-        if ($this->model) 
199
-        {
200
-            return \Response::json(call_user_func_array("\Core::{$this->model}", [])->delete($id), 200);
201
-        }
202
-    }
203
-
204
-    /**
205
-     * Check if the logged in user can do the given permission.
206
-     * 
207
-     * @param  string $permission
208
-     * @return void
209
-     */
210
-    private function checkPermission($permission)
211
-    {
212
-        $permission = $permission !== 'index' ? $permission : 'list';
213
-        if ($permission == 'method') 
214
-        {
215
-            \ErrorHandler::notFound('method');
216
-        }
217
-        else if ( ! in_array($permission, $this->skipLoginCheck)) 
218
-        {
219
-            \JWTAuth::parseToken()->authenticate();
220
-            if ( ! in_array($permission, $this->skipPermissionCheck) && ! \Core::users()->can($permission, $this->model))
221
-            {
222
-                \ErrorHandler::noPermissions();
223
-            }
224
-        }
225
-    }
182
+		$this->validate($request, $this->validationRules);
183
+
184
+		if ($this->model) 
185
+		{
186
+			return \Response::json(call_user_func_array("\Core::{$this->model}", [])->save($request->all()), 200);
187
+		}
188
+	}
189
+
190
+	/**
191
+	 * Delete by the given id from model repository.
192
+	 * 
193
+	 * @param  integer  $id
194
+	 * @return \Illuminate\Http\Response
195
+	 */
196
+	public function getDelete($id) 
197
+	{
198
+		if ($this->model) 
199
+		{
200
+			return \Response::json(call_user_func_array("\Core::{$this->model}", [])->delete($id), 200);
201
+		}
202
+	}
203
+
204
+	/**
205
+	 * Check if the logged in user can do the given permission.
206
+	 * 
207
+	 * @param  string $permission
208
+	 * @return void
209
+	 */
210
+	private function checkPermission($permission)
211
+	{
212
+		$permission = $permission !== 'index' ? $permission : 'list';
213
+		if ($permission == 'method') 
214
+		{
215
+			\ErrorHandler::notFound('method');
216
+		}
217
+		else if ( ! in_array($permission, $this->skipLoginCheck)) 
218
+		{
219
+			\JWTAuth::parseToken()->authenticate();
220
+			if ( ! in_array($permission, $this->skipPermissionCheck) && ! \Core::users()->can($permission, $this->model))
221
+			{
222
+				\ErrorHandler::noPermissions();
223
+			}
224
+		}
225
+	}
226 226
 }
Please login to merge, or discard this patch.
V1/Reporting/Database/Migrations/2016_01_19_112603_sampel_report.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,15 +22,15 @@
 block discarded – undo
22 22
 			");
23 23
 		
24 24
 		DB::table('reports')->insert(
25
-        	[
26
-	        	[
25
+			[
26
+				[
27 27
 				'report_name' => 'admin_count',
28 28
 				'view_name'   => 'admin_count',
29 29
 				'created_at'  => \DB::raw('NOW()'),
30 30
 				'updated_at'  => \DB::raw('NOW()')
31
-	        	]
32
-        	]
33
-        );
31
+				]
32
+			]
33
+		);
34 34
 	}
35 35
 
36 36
 	/**
Please login to merge, or discard this patch.
src/Modules/V1/Reporting/Database/Migrations/2016_01_19_112350_reports.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 			$table->string('view_name',100);
19 19
 			$table->softDeletes();
20 20
 			$table->timestamps();
21
-        });
21
+		});
22 22
 	}
23 23
 
24 24
 	/**
Please login to merge, or discard this patch.
Modules/V1/Reporting/Database/Migrations/2016_01_24_123631_initialize.php 1 patch
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -12,71 +12,71 @@
 block discarded – undo
12 12
 	 */
13 13
 	public function up()
14 14
 	{
15
-        /**
16
-         * Delete previous permissions.
17
-         */
15
+		/**
16
+		 * Delete previous permissions.
17
+		 */
18 18
 		DB::table('permissions')->whereIn('model', ['reports'])->delete();
19 19
 
20 20
 		/**
21
-         * Insert the permissions related to this module.
22
-         */
23
-        DB::table('permissions')->insert(
24
-        	[
25
-        		/**
26
-        		 * Reporting model permissions.
27
-        		 */
28
-	        	[
29
-	        	'name'       => 'find',
30
-	        	'model'      => 'reports',
31
-	        	'created_at' => \DB::raw('NOW()'),
32
-	        	'updated_at' => \DB::raw('NOW()')
33
-	        	],
34
-	        	[
35
-	        	'name'       => 'search',
36
-	        	'model'      => 'reports',
37
-	        	'created_at' => \DB::raw('NOW()'),
38
-	        	'updated_at' => \DB::raw('NOW()')
39
-	        	],
40
-	        	[
41
-	        	'name'       => 'list',
42
-	        	'model'      => 'reports',
43
-	        	'created_at' => \DB::raw('NOW()'),
44
-	        	'updated_at' => \DB::raw('NOW()')
45
-	        	],
46
-	        	[
47
-	        	'name'       => 'findby',
48
-	        	'model'      => 'reports',
49
-	        	'created_at' => \DB::raw('NOW()'),
50
-	        	'updated_at' => \DB::raw('NOW()')
51
-	        	],
52
-	        	[
53
-	        	'name'       => 'first',
54
-	        	'model'      => 'reports',
55
-	        	'created_at' => \DB::raw('NOW()'),
56
-	        	'updated_at' => \DB::raw('NOW()')
57
-	        	],
58
-	        	[
59
-	        	'name'       => 'paginate',
60
-	        	'model'      => 'reports',
61
-	        	'created_at' => \DB::raw('NOW()'),
62
-	        	'updated_at' => \DB::raw('NOW()')
63
-	        	],
64
-	        	[
65
-	        	'name'       => 'paginateby',
66
-	        	'model'      => 'reports',
67
-	        	'created_at' => \DB::raw('NOW()'),
68
-	        	'updated_at' => \DB::raw('NOW()')
69
-	        	],
70
-	        	[
71
-	        	'name'       => 'admin_count',
72
-	        	'model'      => 'reports',
73
-	        	'created_at' => \DB::raw('NOW()'),
74
-	        	'updated_at' => \DB::raw('NOW()')
75
-	        	]
76
-        	]
77
-        );
21
+		 * Insert the permissions related to this module.
22
+		 */
23
+		DB::table('permissions')->insert(
24
+			[
25
+				/**
26
+				 * Reporting model permissions.
27
+				 */
28
+				[
29
+				'name'       => 'find',
30
+				'model'      => 'reports',
31
+				'created_at' => \DB::raw('NOW()'),
32
+				'updated_at' => \DB::raw('NOW()')
33
+				],
34
+				[
35
+				'name'       => 'search',
36
+				'model'      => 'reports',
37
+				'created_at' => \DB::raw('NOW()'),
38
+				'updated_at' => \DB::raw('NOW()')
39
+				],
40
+				[
41
+				'name'       => 'list',
42
+				'model'      => 'reports',
43
+				'created_at' => \DB::raw('NOW()'),
44
+				'updated_at' => \DB::raw('NOW()')
45
+				],
46
+				[
47
+				'name'       => 'findby',
48
+				'model'      => 'reports',
49
+				'created_at' => \DB::raw('NOW()'),
50
+				'updated_at' => \DB::raw('NOW()')
51
+				],
52
+				[
53
+				'name'       => 'first',
54
+				'model'      => 'reports',
55
+				'created_at' => \DB::raw('NOW()'),
56
+				'updated_at' => \DB::raw('NOW()')
57
+				],
58
+				[
59
+				'name'       => 'paginate',
60
+				'model'      => 'reports',
61
+				'created_at' => \DB::raw('NOW()'),
62
+				'updated_at' => \DB::raw('NOW()')
63
+				],
64
+				[
65
+				'name'       => 'paginateby',
66
+				'model'      => 'reports',
67
+				'created_at' => \DB::raw('NOW()'),
68
+				'updated_at' => \DB::raw('NOW()')
69
+				],
70
+				[
71
+				'name'       => 'admin_count',
72
+				'model'      => 'reports',
73
+				'created_at' => \DB::raw('NOW()'),
74
+				'updated_at' => \DB::raw('NOW()')
75
+				]
76
+			]
77
+		);
78 78
 
79
-        /**
79
+		/**
80 80
 		 * Assign the permissions to the admin group.
81 81
 		 */
82 82
 		$permissionIds = DB::table('permissions')->whereIn('model', ['reports'])->select('id')->lists('id');
Please login to merge, or discard this patch.
src/Modules/V1/Reporting/ModelObservers/ReprotObserver.php 1 patch
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -5,44 +5,44 @@
 block discarded – undo
5 5
  */
6 6
 class LogObserver {
7 7
 
8
-    public function saving($model)
9
-    {
10
-        //
11
-    }
12
-
13
-    public function saved($model)
14
-    {
15
-        //
16
-    }
17
-
18
-    public function creating($model)
19
-    {
20
-        //
21
-    }
22
-
23
-    public function created($model)
24
-    {
25
-        //
26
-    }
27
-
28
-    public function updating($model)
29
-    {
30
-        //
31
-    }
32
-
33
-    public function updated($model)
34
-    {
35
-        //
36
-    }
37
-
38
-    public function deleting($model)
39
-    {
40
-        //
41
-    }
42
-
43
-    public function deleted($model)
44
-    {
45
-        //
46
-    }
8
+	public function saving($model)
9
+	{
10
+		//
11
+	}
12
+
13
+	public function saved($model)
14
+	{
15
+		//
16
+	}
17
+
18
+	public function creating($model)
19
+	{
20
+		//
21
+	}
22
+
23
+	public function created($model)
24
+	{
25
+		//
26
+	}
27
+
28
+	public function updating($model)
29
+	{
30
+		//
31
+	}
32
+
33
+	public function updated($model)
34
+	{
35
+		//
36
+	}
37
+
38
+	public function deleting($model)
39
+	{
40
+		//
41
+	}
42
+
43
+	public function deleted($model)
44
+	{
45
+		//
46
+	}
47 47
 
48 48
 }
49 49
\ No newline at end of file
Please login to merge, or discard this patch.
src/Modules/V1/Reporting/Repositories/ReportRepository.php 1 patch
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -11,59 +11,59 @@
 block discarded – undo
11 11
 	 */
12 12
 	protected function getModel()
13 13
 	{
14
-        $apiVersion = \Request::header('api-version') ?: 1;
14
+		$apiVersion = \Request::header('api-version') ?: 1;
15 15
 		return 'App\Modules\V1\Reporting\Report';
16 16
 	}
17 17
 
18 18
 	/**
19
-     * Render the given report db view.
20
-     * 
21
-     * @param  integer $id
22
-     * @param  array   $relations
23
-     * @param  array   $columns
24
-     * @return object
25
-     */
26
-    public function find($id, $relations = [], $columns = array('*'))
27
-    {
19
+	 * Render the given report db view.
20
+	 * 
21
+	 * @param  integer $id
22
+	 * @param  array   $relations
23
+	 * @param  array   $columns
24
+	 * @return object
25
+	 */
26
+	public function find($id, $relations = [], $columns = array('*'))
27
+	{
28 28
 		$report = call_user_func_array("{$this->getModel()}::with", array($relations))->find($id, $columns);
29 29
 
30
-        if ( ! $report) 
31
-        {
32
-            \ErrorHandler::notFound('report');
33
-        }
30
+		if ( ! $report) 
31
+		{
32
+			\ErrorHandler::notFound('report');
33
+		}
34 34
 
35
-        if ( ! \Core::users()->can($report->view_name, 'reports'))
36
-        {
37
-            \ErrorHandler::noPermissions();
38
-        }
35
+		if ( ! \Core::users()->can($report->view_name, 'reports'))
36
+		{
37
+			\ErrorHandler::noPermissions();
38
+		}
39 39
 
40
-        return \DB::table($report->view_name)->get();
41
-    }
40
+		return \DB::table($report->view_name)->get();
41
+	}
42 42
 
43
-    /**
44
-     * Render the given report db view based on the given
45
-     * condition.
46
-     *
47
-     * @param  array   $conditions array of conditions
48
-     * @param  array   $relations
49
-     * @param  array   $colunmns
50
-     * @return object
51
-     */
52
-    public function first($conditions, $relations = [], $columns = array('*'))
53
-    {
43
+	/**
44
+	 * Render the given report db view based on the given
45
+	 * condition.
46
+	 *
47
+	 * @param  array   $conditions array of conditions
48
+	 * @param  array   $relations
49
+	 * @param  array   $colunmns
50
+	 * @return object
51
+	 */
52
+	public function first($conditions, $relations = [], $columns = array('*'))
53
+	{
54 54
 		$conditions = $this->constructConditions($conditions);
55 55
 		$report     = call_user_func_array("{$this->getModel()}::with", array($relations))->whereRaw($conditions['conditionString'], $conditions['conditionValues'])->first($columns);
56 56
         
57
-        if ( ! $report) 
58
-        {
59
-            \ErrorHandler::notFound('report');
60
-        }
57
+		if ( ! $report) 
58
+		{
59
+			\ErrorHandler::notFound('report');
60
+		}
61 61
         
62
-        if ( ! \Core::users()->can($report->view_name, 'reports'))
63
-        {
64
-            \ErrorHandler::noPermissions();
65
-        }
62
+		if ( ! \Core::users()->can($report->view_name, 'reports'))
63
+		{
64
+			\ErrorHandler::noPermissions();
65
+		}
66 66
 		
67
-        return \DB::table($report->view_name)->get();  
68
-    }
67
+		return \DB::table($report->view_name)->get();  
68
+	}
69 69
 }
Please login to merge, or discard this patch.
src/Modules/V1/Reporting/Http/Controllers/ReportsController.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -8,16 +8,16 @@
 block discarded – undo
8 8
 class ReportsController extends BaseApiController
9 9
 {
10 10
 	/**
11
-     * The name of the model that is used by the base api controller 
12
-     * to preform actions like (add, edit ... etc).
13
-     * @var string
14
-     */
15
-    protected $model            = 'reports';
11
+	 * The name of the model that is used by the base api controller 
12
+	 * to preform actions like (add, edit ... etc).
13
+	 * @var string
14
+	 */
15
+	protected $model            = 'reports';
16 16
 
17
-    /**
18
-     * List of all route actions that the base api controller
19
-     * will skip permissions check for them.
20
-     * @var array
21
-     */
22
-    protected $skipPermissionCheck = ['find', 'first'];
17
+	/**
18
+	 * List of all route actions that the base api controller
19
+	 * will skip permissions check for them.
20
+	 * @var array
21
+	 */
22
+	protected $skipPermissionCheck = ['find', 'first'];
23 23
 }
Please login to merge, or discard this patch.