@@ -7,250 +7,250 @@ |
||
7 | 7 | |
8 | 8 | abstract class BaseService implements BaseServiceInterface |
9 | 9 | { |
10 | - /** |
|
11 | - * @var object |
|
12 | - */ |
|
13 | - public $repo; |
|
10 | + /** |
|
11 | + * @var object |
|
12 | + */ |
|
13 | + public $repo; |
|
14 | 14 | |
15 | - /** |
|
16 | - * Init new object. |
|
17 | - * |
|
18 | - * @param mixed $repo |
|
19 | - * @return void |
|
20 | - */ |
|
21 | - public function __construct($repo) |
|
22 | - { |
|
23 | - $this->repo = $repo; |
|
24 | - } |
|
15 | + /** |
|
16 | + * Init new object. |
|
17 | + * |
|
18 | + * @param mixed $repo |
|
19 | + * @return void |
|
20 | + */ |
|
21 | + public function __construct($repo) |
|
22 | + { |
|
23 | + $this->repo = $repo; |
|
24 | + } |
|
25 | 25 | |
26 | - /** |
|
27 | - * Fetch records with relations based on the given params. |
|
28 | - * |
|
29 | - * @param array $relations |
|
30 | - * @param array $conditions |
|
31 | - * @param integer $perPage |
|
32 | - * @param string $sortBy |
|
33 | - * @param boolean $desc |
|
34 | - * @param boolean $trashed |
|
35 | - * @return collection |
|
36 | - */ |
|
37 | - public function list($relations = [], $conditions = false, $perPage = 15, $sortBy = 'created_at', $desc = true, $trashed = false) |
|
38 | - { |
|
39 | - $translatable = $this->repo->model->translatable ?? []; |
|
40 | - $filters = $this->constructFilters($conditions); |
|
41 | - $sortBy = in_array($sortBy, $translatable) ? $sortBy . '->' . Session::get('locale') : $sortBy; |
|
26 | + /** |
|
27 | + * Fetch records with relations based on the given params. |
|
28 | + * |
|
29 | + * @param array $relations |
|
30 | + * @param array $conditions |
|
31 | + * @param integer $perPage |
|
32 | + * @param string $sortBy |
|
33 | + * @param boolean $desc |
|
34 | + * @param boolean $trashed |
|
35 | + * @return collection |
|
36 | + */ |
|
37 | + public function list($relations = [], $conditions = false, $perPage = 15, $sortBy = 'created_at', $desc = true, $trashed = false) |
|
38 | + { |
|
39 | + $translatable = $this->repo->model->translatable ?? []; |
|
40 | + $filters = $this->constructFilters($conditions); |
|
41 | + $sortBy = in_array($sortBy, $translatable) ? $sortBy . '->' . Session::get('locale') : $sortBy; |
|
42 | 42 | |
43 | - if ($trashed) { |
|
44 | - return $this->deleted(['and' => $filters], $perPage ?? 15, $sortBy ?? 'created_at', $desc ?? true); |
|
45 | - } |
|
43 | + if ($trashed) { |
|
44 | + return $this->deleted(['and' => $filters], $perPage ?? 15, $sortBy ?? 'created_at', $desc ?? true); |
|
45 | + } |
|
46 | 46 | |
47 | - if (count($filters)) { |
|
48 | - return $this->paginateBy(['and' => $filters], $perPage ?? 15, $relations, $sortBy ?? 'created_at', $desc ?? true); |
|
49 | - } |
|
47 | + if (count($filters)) { |
|
48 | + return $this->paginateBy(['and' => $filters], $perPage ?? 15, $relations, $sortBy ?? 'created_at', $desc ?? true); |
|
49 | + } |
|
50 | 50 | |
51 | - return $this->paginate($perPage ?? 15, $relations, $sortBy ?? 'created_at', $desc ?? true); |
|
52 | - } |
|
51 | + return $this->paginate($perPage ?? 15, $relations, $sortBy ?? 'created_at', $desc ?? true); |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * Fetch all records with relations from the storage. |
|
56 | - * |
|
57 | - * @param array $relations |
|
58 | - * @param string $sortBy |
|
59 | - * @param boolean $desc |
|
60 | - * @param array $columns |
|
61 | - * @return collection |
|
62 | - */ |
|
63 | - public function all($relations = [], $sortBy = 'created_at', $desc = 1, $columns = ['*']) |
|
64 | - { |
|
65 | - return $this->repo->all($relations, $sortBy, $desc, $columns); |
|
66 | - } |
|
54 | + /** |
|
55 | + * Fetch all records with relations from the storage. |
|
56 | + * |
|
57 | + * @param array $relations |
|
58 | + * @param string $sortBy |
|
59 | + * @param boolean $desc |
|
60 | + * @param array $columns |
|
61 | + * @return collection |
|
62 | + */ |
|
63 | + public function all($relations = [], $sortBy = 'created_at', $desc = 1, $columns = ['*']) |
|
64 | + { |
|
65 | + return $this->repo->all($relations, $sortBy, $desc, $columns); |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * Fetch all records with relations from storage in pages. |
|
70 | - * |
|
71 | - * @param integer $perPage |
|
72 | - * @param array $relations |
|
73 | - * @param string $sortBy |
|
74 | - * @param boolean $desc |
|
75 | - * @param array $columns |
|
76 | - * @return collection |
|
77 | - */ |
|
78 | - public function paginate($perPage = 15, $relations = [], $sortBy = 'created_at', $desc = 1, $columns = ['*']) |
|
79 | - { |
|
80 | - return $this->repo->paginate($perPage, $relations, $sortBy, $desc, $columns); |
|
81 | - } |
|
68 | + /** |
|
69 | + * Fetch all records with relations from storage in pages. |
|
70 | + * |
|
71 | + * @param integer $perPage |
|
72 | + * @param array $relations |
|
73 | + * @param string $sortBy |
|
74 | + * @param boolean $desc |
|
75 | + * @param array $columns |
|
76 | + * @return collection |
|
77 | + */ |
|
78 | + public function paginate($perPage = 15, $relations = [], $sortBy = 'created_at', $desc = 1, $columns = ['*']) |
|
79 | + { |
|
80 | + return $this->repo->paginate($perPage, $relations, $sortBy, $desc, $columns); |
|
81 | + } |
|
82 | 82 | |
83 | - /** |
|
84 | - * Fetch all records with relations based on |
|
85 | - * the given condition from storage in pages. |
|
86 | - * |
|
87 | - * @param array $conditions array of conditions |
|
88 | - * @param integer $perPage |
|
89 | - * @param array $relations |
|
90 | - * @param string $sortBy |
|
91 | - * @param boolean $desc |
|
92 | - * @param array $columns |
|
93 | - * @return collection |
|
94 | - */ |
|
95 | - public function paginateBy($conditions, $perPage = 15, $relations = [], $sortBy = 'created_at', $desc = 1, $columns = ['*']) |
|
96 | - { |
|
97 | - return $this->repo->paginateBy($conditions, $perPage, $relations, $sortBy, $desc, $columns); |
|
98 | - } |
|
83 | + /** |
|
84 | + * Fetch all records with relations based on |
|
85 | + * the given condition from storage in pages. |
|
86 | + * |
|
87 | + * @param array $conditions array of conditions |
|
88 | + * @param integer $perPage |
|
89 | + * @param array $relations |
|
90 | + * @param string $sortBy |
|
91 | + * @param boolean $desc |
|
92 | + * @param array $columns |
|
93 | + * @return collection |
|
94 | + */ |
|
95 | + public function paginateBy($conditions, $perPage = 15, $relations = [], $sortBy = 'created_at', $desc = 1, $columns = ['*']) |
|
96 | + { |
|
97 | + return $this->repo->paginateBy($conditions, $perPage, $relations, $sortBy, $desc, $columns); |
|
98 | + } |
|
99 | 99 | |
100 | - /** |
|
101 | - * Save the given model to the storage. |
|
102 | - * |
|
103 | - * @param array $data |
|
104 | - * @return mixed |
|
105 | - */ |
|
106 | - public function save(array $data) |
|
107 | - { |
|
108 | - return $this->repo->save($data); |
|
109 | - } |
|
100 | + /** |
|
101 | + * Save the given model to the storage. |
|
102 | + * |
|
103 | + * @param array $data |
|
104 | + * @return mixed |
|
105 | + */ |
|
106 | + public function save(array $data) |
|
107 | + { |
|
108 | + return $this->repo->save($data); |
|
109 | + } |
|
110 | 110 | |
111 | - /** |
|
112 | - * Delete record from the storage based on the given |
|
113 | - * condition. |
|
114 | - * |
|
115 | - * @param var $value condition value |
|
116 | - * @param string $attribute condition column name |
|
117 | - * @return void |
|
118 | - */ |
|
119 | - public function delete($value, $attribute = 'id') |
|
120 | - { |
|
121 | - return $this->repo->delete($value, $attribute); |
|
122 | - } |
|
111 | + /** |
|
112 | + * Delete record from the storage based on the given |
|
113 | + * condition. |
|
114 | + * |
|
115 | + * @param var $value condition value |
|
116 | + * @param string $attribute condition column name |
|
117 | + * @return void |
|
118 | + */ |
|
119 | + public function delete($value, $attribute = 'id') |
|
120 | + { |
|
121 | + return $this->repo->delete($value, $attribute); |
|
122 | + } |
|
123 | 123 | |
124 | - /** |
|
125 | - * Fetch records from the storage based on the given |
|
126 | - * id. |
|
127 | - * |
|
128 | - * @param integer $id |
|
129 | - * @param array $relations |
|
130 | - * @param array $columns |
|
131 | - * @return object |
|
132 | - */ |
|
133 | - public function find($id, $relations = [], $columns = ['*']) |
|
134 | - { |
|
135 | - return $this->repo->find($id, $relations, $columns); |
|
136 | - } |
|
124 | + /** |
|
125 | + * Fetch records from the storage based on the given |
|
126 | + * id. |
|
127 | + * |
|
128 | + * @param integer $id |
|
129 | + * @param array $relations |
|
130 | + * @param array $columns |
|
131 | + * @return object |
|
132 | + */ |
|
133 | + public function find($id, $relations = [], $columns = ['*']) |
|
134 | + { |
|
135 | + return $this->repo->find($id, $relations, $columns); |
|
136 | + } |
|
137 | 137 | |
138 | - /** |
|
139 | - * Fetch records from the storage based on the given |
|
140 | - * condition. |
|
141 | - * |
|
142 | - * @param array $conditions array of conditions |
|
143 | - * @param array $relations |
|
144 | - * @param string $sortBy |
|
145 | - * @param boolean $desc |
|
146 | - * @param array $columns |
|
147 | - * @return collection |
|
148 | - */ |
|
149 | - public function findBy($conditions, $relations = [], $sortBy = 'created_at', $desc = 1, $columns = ['*']) |
|
150 | - { |
|
151 | - return $this->repo->findBy($conditions, $relations, $sortBy, $desc, $columns); |
|
152 | - } |
|
138 | + /** |
|
139 | + * Fetch records from the storage based on the given |
|
140 | + * condition. |
|
141 | + * |
|
142 | + * @param array $conditions array of conditions |
|
143 | + * @param array $relations |
|
144 | + * @param string $sortBy |
|
145 | + * @param boolean $desc |
|
146 | + * @param array $columns |
|
147 | + * @return collection |
|
148 | + */ |
|
149 | + public function findBy($conditions, $relations = [], $sortBy = 'created_at', $desc = 1, $columns = ['*']) |
|
150 | + { |
|
151 | + return $this->repo->findBy($conditions, $relations, $sortBy, $desc, $columns); |
|
152 | + } |
|
153 | 153 | |
154 | - /** |
|
155 | - * Fetch the first record from the storage based on the given |
|
156 | - * condition. |
|
157 | - * |
|
158 | - * @param array $conditions array of conditions |
|
159 | - * @param array $relations |
|
160 | - * @param array $columns |
|
161 | - * @return object |
|
162 | - */ |
|
163 | - public function first($conditions, $relations = [], $columns = ['*']) |
|
164 | - { |
|
165 | - return $this->repo->first($conditions, $relations, $columns); |
|
166 | - } |
|
154 | + /** |
|
155 | + * Fetch the first record from the storage based on the given |
|
156 | + * condition. |
|
157 | + * |
|
158 | + * @param array $conditions array of conditions |
|
159 | + * @param array $relations |
|
160 | + * @param array $columns |
|
161 | + * @return object |
|
162 | + */ |
|
163 | + public function first($conditions, $relations = [], $columns = ['*']) |
|
164 | + { |
|
165 | + return $this->repo->first($conditions, $relations, $columns); |
|
166 | + } |
|
167 | 167 | |
168 | - /** |
|
169 | - * Return the deleted models in pages based on the given conditions. |
|
170 | - * |
|
171 | - * @param array $conditions array of conditions |
|
172 | - * @param integer $perPage |
|
173 | - * @param string $sortBy |
|
174 | - * @param boolean $desc |
|
175 | - * @param array $columns |
|
176 | - * @return collection |
|
177 | - */ |
|
178 | - public function deleted($conditions, $perPage = 15, $sortBy = 'created_at', $desc = 1, $columns = ['*']) |
|
179 | - { |
|
180 | - return $this->repo->deleted($conditions, $perPage, $sortBy, $desc, $columns); |
|
181 | - } |
|
168 | + /** |
|
169 | + * Return the deleted models in pages based on the given conditions. |
|
170 | + * |
|
171 | + * @param array $conditions array of conditions |
|
172 | + * @param integer $perPage |
|
173 | + * @param string $sortBy |
|
174 | + * @param boolean $desc |
|
175 | + * @param array $columns |
|
176 | + * @return collection |
|
177 | + */ |
|
178 | + public function deleted($conditions, $perPage = 15, $sortBy = 'created_at', $desc = 1, $columns = ['*']) |
|
179 | + { |
|
180 | + return $this->repo->deleted($conditions, $perPage, $sortBy, $desc, $columns); |
|
181 | + } |
|
182 | 182 | |
183 | - /** |
|
184 | - * Restore the deleted model. |
|
185 | - * |
|
186 | - * @param integer $id |
|
187 | - * @return void |
|
188 | - */ |
|
189 | - public function restore($id) |
|
190 | - { |
|
191 | - return $this->repo->restore($id); |
|
192 | - } |
|
183 | + /** |
|
184 | + * Restore the deleted model. |
|
185 | + * |
|
186 | + * @param integer $id |
|
187 | + * @return void |
|
188 | + */ |
|
189 | + public function restore($id) |
|
190 | + { |
|
191 | + return $this->repo->restore($id); |
|
192 | + } |
|
193 | 193 | |
194 | - /** |
|
195 | - * Prepare filters for repo. |
|
196 | - * |
|
197 | - * @param array $conditions |
|
198 | - * @return array |
|
199 | - */ |
|
200 | - public function constructFilters($conditions) |
|
201 | - { |
|
202 | - $filters = []; |
|
203 | - $translatable = $this->repo->model->translatable ?? []; |
|
204 | - foreach ($conditions as $key => $value) { |
|
205 | - if ((in_array($key, $this->repo->model->fillable ?? []) || method_exists($this->repo->model, $key) || in_array($key, ['or', 'and'])) && $key !== 'trashed') { |
|
206 | - /** |
|
207 | - * Prepare key based on the the requested lang if it was translatable. |
|
208 | - */ |
|
209 | - $key = in_array($key, $translatable) ? $key . '->' . (Session::get('locale') == 'all' ? 'en' : Session::get('locale')) : $key; |
|
194 | + /** |
|
195 | + * Prepare filters for repo. |
|
196 | + * |
|
197 | + * @param array $conditions |
|
198 | + * @return array |
|
199 | + */ |
|
200 | + public function constructFilters($conditions) |
|
201 | + { |
|
202 | + $filters = []; |
|
203 | + $translatable = $this->repo->model->translatable ?? []; |
|
204 | + foreach ($conditions as $key => $value) { |
|
205 | + if ((in_array($key, $this->repo->model->fillable ?? []) || method_exists($this->repo->model, $key) || in_array($key, ['or', 'and'])) && $key !== 'trashed') { |
|
206 | + /** |
|
207 | + * Prepare key based on the the requested lang if it was translatable. |
|
208 | + */ |
|
209 | + $key = in_array($key, $translatable) ? $key . '->' . (Session::get('locale') == 'all' ? 'en' : Session::get('locale')) : $key; |
|
210 | 210 | |
211 | - /** |
|
212 | - * Convert 0/1 or true/false to boolean in case of not foreign key. |
|
213 | - */ |
|
214 | - if (filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) !== null && strpos($key, '_id') === false && ! is_null($value)) { |
|
215 | - $filters[$key] = filter_var($value, FILTER_VALIDATE_BOOLEAN); |
|
211 | + /** |
|
212 | + * Convert 0/1 or true/false to boolean in case of not foreign key. |
|
213 | + */ |
|
214 | + if (filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) !== null && strpos($key, '_id') === false && ! is_null($value)) { |
|
215 | + $filters[$key] = filter_var($value, FILTER_VALIDATE_BOOLEAN); |
|
216 | 216 | |
217 | - /** |
|
218 | - * Use in operator in case of foreign and comma seperated values. |
|
219 | - */ |
|
220 | - } elseif (! is_array($value) && strpos($key, '_id') && $value) { |
|
221 | - $filters[$key] = [ |
|
222 | - 'op' => 'in', |
|
223 | - 'val' => explode(',', $value) |
|
224 | - ]; |
|
217 | + /** |
|
218 | + * Use in operator in case of foreign and comma seperated values. |
|
219 | + */ |
|
220 | + } elseif (! is_array($value) && strpos($key, '_id') && $value) { |
|
221 | + $filters[$key] = [ |
|
222 | + 'op' => 'in', |
|
223 | + 'val' => explode(',', $value) |
|
224 | + ]; |
|
225 | 225 | |
226 | - /** |
|
227 | - * Use null operator in case of 0 value and foreign. |
|
228 | - */ |
|
229 | - } elseif (strpos($key, '_id') && $value == 0) { |
|
230 | - $filters[$key] = [ |
|
231 | - 'op' => 'null' |
|
232 | - ]; |
|
226 | + /** |
|
227 | + * Use null operator in case of 0 value and foreign. |
|
228 | + */ |
|
229 | + } elseif (strpos($key, '_id') && $value == 0) { |
|
230 | + $filters[$key] = [ |
|
231 | + 'op' => 'null' |
|
232 | + ]; |
|
233 | 233 | |
234 | - /** |
|
235 | - * Consider values as a sub conditions if it is array. |
|
236 | - */ |
|
237 | - } elseif (is_array($value)) { |
|
238 | - $filters[$key] = $value; |
|
234 | + /** |
|
235 | + * Consider values as a sub conditions if it is array. |
|
236 | + */ |
|
237 | + } elseif (is_array($value)) { |
|
238 | + $filters[$key] = $value; |
|
239 | 239 | |
240 | - /** |
|
241 | - * Default string filteration. |
|
242 | - */ |
|
243 | - } elseif ($value) { |
|
244 | - $key = 'LOWER(' . $key . ')'; |
|
245 | - $value = strtolower($value); |
|
246 | - $filters[$key] = [ |
|
247 | - 'op' => 'like', |
|
248 | - 'val' => '%' . $value . '%' |
|
249 | - ]; |
|
250 | - } |
|
251 | - } |
|
252 | - } |
|
240 | + /** |
|
241 | + * Default string filteration. |
|
242 | + */ |
|
243 | + } elseif ($value) { |
|
244 | + $key = 'LOWER(' . $key . ')'; |
|
245 | + $value = strtolower($value); |
|
246 | + $filters[$key] = [ |
|
247 | + 'op' => 'like', |
|
248 | + 'val' => '%' . $value . '%' |
|
249 | + ]; |
|
250 | + } |
|
251 | + } |
|
252 | + } |
|
253 | 253 | |
254 | - return $filters; |
|
255 | - } |
|
254 | + return $filters; |
|
255 | + } |
|
256 | 256 | } |
@@ -9,23 +9,23 @@ |
||
9 | 9 | class Setting extends Model |
10 | 10 | { |
11 | 11 | |
12 | - use SoftDeletes, Translatable; |
|
13 | - protected $table = 'settings'; |
|
14 | - protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
15 | - protected $hidden = ['deleted_at']; |
|
16 | - protected $guarded = ['id', 'key']; |
|
17 | - public $fillable = ['name', 'value']; |
|
18 | - public $translatable = ['value']; |
|
19 | - public $casts = ['value' => 'json']; |
|
12 | + use SoftDeletes, Translatable; |
|
13 | + protected $table = 'settings'; |
|
14 | + protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
15 | + protected $hidden = ['deleted_at']; |
|
16 | + protected $guarded = ['id', 'key']; |
|
17 | + public $fillable = ['name', 'value']; |
|
18 | + public $translatable = ['value']; |
|
19 | + public $casts = ['value' => 'json']; |
|
20 | 20 | |
21 | - public function newCollection(array $models = []) |
|
22 | - { |
|
23 | - return parent::newCollection($models)->keyBy('key'); |
|
24 | - } |
|
21 | + public function newCollection(array $models = []) |
|
22 | + { |
|
23 | + return parent::newCollection($models)->keyBy('key'); |
|
24 | + } |
|
25 | 25 | |
26 | - public static function boot() |
|
27 | - { |
|
28 | - parent::boot(); |
|
29 | - Setting::observe(SettingsObserver::class); |
|
30 | - } |
|
26 | + public static function boot() |
|
27 | + { |
|
28 | + parent::boot(); |
|
29 | + Setting::observe(SettingsObserver::class); |
|
30 | + } |
|
31 | 31 | } |
@@ -7,25 +7,25 @@ |
||
7 | 7 | |
8 | 8 | class Permission extends JsonResource |
9 | 9 | { |
10 | - /** |
|
11 | - * Transform the resource into an array. |
|
12 | - * |
|
13 | - * @param Request $request |
|
14 | - * @return array |
|
15 | - */ |
|
16 | - public function toArray($request) |
|
17 | - { |
|
18 | - if (! $this->resource) { |
|
19 | - return []; |
|
20 | - } |
|
10 | + /** |
|
11 | + * Transform the resource into an array. |
|
12 | + * |
|
13 | + * @param Request $request |
|
14 | + * @return array |
|
15 | + */ |
|
16 | + public function toArray($request) |
|
17 | + { |
|
18 | + if (! $this->resource) { |
|
19 | + return []; |
|
20 | + } |
|
21 | 21 | |
22 | - return [ |
|
23 | - 'id' => $this->id, |
|
24 | - 'name' => $this->name, |
|
25 | - 'model' => $this->model, |
|
26 | - 'roles' => RoleResource::collection($this->whenLoaded('roles')), |
|
27 | - 'created_at' => $this->created_at, |
|
28 | - 'updated_at' => $this->updated_at, |
|
29 | - ]; |
|
30 | - } |
|
22 | + return [ |
|
23 | + 'id' => $this->id, |
|
24 | + 'name' => $this->name, |
|
25 | + 'model' => $this->model, |
|
26 | + 'roles' => RoleResource::collection($this->whenLoaded('roles')), |
|
27 | + 'created_at' => $this->created_at, |
|
28 | + 'updated_at' => $this->updated_at, |
|
29 | + ]; |
|
30 | + } |
|
31 | 31 | } |
@@ -9,88 +9,88 @@ |
||
9 | 9 | |
10 | 10 | class Handler extends ExceptionHandler |
11 | 11 | { |
12 | - /** |
|
13 | - * A list of the exception types that are not reported. |
|
14 | - * |
|
15 | - * @var array |
|
16 | - */ |
|
17 | - protected $dontReport = [ |
|
18 | - \League\OAuth2\Server\Exception\OAuthServerException::class, |
|
19 | - ]; |
|
12 | + /** |
|
13 | + * A list of the exception types that are not reported. |
|
14 | + * |
|
15 | + * @var array |
|
16 | + */ |
|
17 | + protected $dontReport = [ |
|
18 | + \League\OAuth2\Server\Exception\OAuthServerException::class, |
|
19 | + ]; |
|
20 | 20 | |
21 | - /** |
|
22 | - * A list of the inputs that are never flashed for validation exceptions. |
|
23 | - * |
|
24 | - * @var array |
|
25 | - */ |
|
26 | - protected $dontFlash = [ |
|
27 | - 'password', |
|
28 | - 'password_confirmation', |
|
29 | - ]; |
|
21 | + /** |
|
22 | + * A list of the inputs that are never flashed for validation exceptions. |
|
23 | + * |
|
24 | + * @var array |
|
25 | + */ |
|
26 | + protected $dontFlash = [ |
|
27 | + 'password', |
|
28 | + 'password_confirmation', |
|
29 | + ]; |
|
30 | 30 | |
31 | - /** |
|
32 | - * Report or log an exception. |
|
33 | - * |
|
34 | - * @param \Throwable $exception |
|
35 | - * @return void |
|
36 | - * |
|
37 | - * @throws \Exception |
|
38 | - */ |
|
39 | - public function report(Throwable $exception) |
|
40 | - { |
|
41 | - parent::report($exception); |
|
42 | - } |
|
31 | + /** |
|
32 | + * Report or log an exception. |
|
33 | + * |
|
34 | + * @param \Throwable $exception |
|
35 | + * @return void |
|
36 | + * |
|
37 | + * @throws \Exception |
|
38 | + */ |
|
39 | + public function report(Throwable $exception) |
|
40 | + { |
|
41 | + parent::report($exception); |
|
42 | + } |
|
43 | 43 | |
44 | - /** |
|
45 | - * Render an exception into an HTTP response. |
|
46 | - * |
|
47 | - * @param \Illuminate\Http\Request $request |
|
48 | - * @param \Throwable $exception |
|
49 | - * @return \Symfony\Component\HttpFoundation\Response |
|
50 | - * |
|
51 | - * @throws \Throwable |
|
52 | - */ |
|
53 | - public function render($request, Throwable $exception) |
|
54 | - { |
|
55 | - $errors = $this->getErrorHandlers(); |
|
44 | + /** |
|
45 | + * Render an exception into an HTTP response. |
|
46 | + * |
|
47 | + * @param \Illuminate\Http\Request $request |
|
48 | + * @param \Throwable $exception |
|
49 | + * @return \Symfony\Component\HttpFoundation\Response |
|
50 | + * |
|
51 | + * @throws \Throwable |
|
52 | + */ |
|
53 | + public function render($request, Throwable $exception) |
|
54 | + { |
|
55 | + $errors = $this->getErrorHandlers(); |
|
56 | 56 | |
57 | - if ($request->wantsJson()) { |
|
58 | - $exceptionClass = get_class($exception); |
|
59 | - return Arr::has($errors, $exceptionClass) ? $errors[$exceptionClass]($request, $exception) : parent::render($request, $exception); |
|
60 | - } |
|
57 | + if ($request->wantsJson()) { |
|
58 | + $exceptionClass = get_class($exception); |
|
59 | + return Arr::has($errors, $exceptionClass) ? $errors[$exceptionClass]($request, $exception) : parent::render($request, $exception); |
|
60 | + } |
|
61 | 61 | |
62 | - return parent::render($request, $exception); |
|
63 | - } |
|
62 | + return parent::render($request, $exception); |
|
63 | + } |
|
64 | 64 | |
65 | - /** |
|
66 | - * Return handler for defined error types |
|
67 | - * |
|
68 | - * @return array |
|
69 | - */ |
|
70 | - protected function getErrorHandlers() |
|
71 | - { |
|
72 | - return [ |
|
73 | - \Illuminate\Auth\AuthenticationException::class => function ($request, $exception) { |
|
74 | - Errors::unAuthorized(); |
|
75 | - }, |
|
76 | - \Illuminate\Database\QueryException::class => function ($request, $exception) { |
|
77 | - Errors::dbQueryError(); |
|
78 | - }, |
|
79 | - \predis\connection\connectionexception::class => function ($request, $exception) { |
|
80 | - Errors::redisNotRunning(); |
|
81 | - }, |
|
82 | - \RedisException::class => function ($request, $exception) { |
|
83 | - Errors::redisNotRunning(); |
|
84 | - }, |
|
85 | - \GuzzleHttp\Exception\ClientException::class => function ($request, $exception) { |
|
86 | - Errors::connectionError(); |
|
87 | - }, |
|
88 | - \Symfony\Component\HttpKernel\Exception\HttpException::class => function ($request, $exception) { |
|
89 | - return response()->json(['errors' => [$exception->getStatusCode() === 404 ? ($exception->getMessage() ?: 'not found') : $exception->getMessage()]], $exception->getStatusCode()); |
|
90 | - }, |
|
91 | - \Illuminate\Validation\ValidationException::class => function ($request, $exception) { |
|
92 | - return response()->json(['errors' => $exception->errors()], 422); |
|
93 | - } |
|
94 | - ]; |
|
95 | - } |
|
65 | + /** |
|
66 | + * Return handler for defined error types |
|
67 | + * |
|
68 | + * @return array |
|
69 | + */ |
|
70 | + protected function getErrorHandlers() |
|
71 | + { |
|
72 | + return [ |
|
73 | + \Illuminate\Auth\AuthenticationException::class => function ($request, $exception) { |
|
74 | + Errors::unAuthorized(); |
|
75 | + }, |
|
76 | + \Illuminate\Database\QueryException::class => function ($request, $exception) { |
|
77 | + Errors::dbQueryError(); |
|
78 | + }, |
|
79 | + \predis\connection\connectionexception::class => function ($request, $exception) { |
|
80 | + Errors::redisNotRunning(); |
|
81 | + }, |
|
82 | + \RedisException::class => function ($request, $exception) { |
|
83 | + Errors::redisNotRunning(); |
|
84 | + }, |
|
85 | + \GuzzleHttp\Exception\ClientException::class => function ($request, $exception) { |
|
86 | + Errors::connectionError(); |
|
87 | + }, |
|
88 | + \Symfony\Component\HttpKernel\Exception\HttpException::class => function ($request, $exception) { |
|
89 | + return response()->json(['errors' => [$exception->getStatusCode() === 404 ? ($exception->getMessage() ?: 'not found') : $exception->getMessage()]], $exception->getStatusCode()); |
|
90 | + }, |
|
91 | + \Illuminate\Validation\ValidationException::class => function ($request, $exception) { |
|
92 | + return response()->json(['errors' => $exception->errors()], 422); |
|
93 | + } |
|
94 | + ]; |
|
95 | + } |
|
96 | 96 | } |
@@ -8,29 +8,29 @@ |
||
8 | 8 | |
9 | 9 | class EventServiceProvider extends ServiceProvider |
10 | 10 | { |
11 | - /** |
|
12 | - * The event listener mappings for the application. |
|
13 | - * |
|
14 | - * @var array |
|
15 | - */ |
|
16 | - protected $listen = [ |
|
17 | - Registered::class => [ |
|
18 | - SendEmailVerificationNotification::class, |
|
19 | - ], |
|
20 | - \SocialiteProviders\Manager\SocialiteWasCalled::class => [ |
|
21 | - 'SocialiteProviders\\Apple\\AppleExtendSocialite@handle', |
|
22 | - ], |
|
23 | - ]; |
|
11 | + /** |
|
12 | + * The event listener mappings for the application. |
|
13 | + * |
|
14 | + * @var array |
|
15 | + */ |
|
16 | + protected $listen = [ |
|
17 | + Registered::class => [ |
|
18 | + SendEmailVerificationNotification::class, |
|
19 | + ], |
|
20 | + \SocialiteProviders\Manager\SocialiteWasCalled::class => [ |
|
21 | + 'SocialiteProviders\\Apple\\AppleExtendSocialite@handle', |
|
22 | + ], |
|
23 | + ]; |
|
24 | 24 | |
25 | - /** |
|
26 | - * Register any events for your application. |
|
27 | - * |
|
28 | - * @return void |
|
29 | - */ |
|
30 | - public function boot() |
|
31 | - { |
|
32 | - parent::boot(); |
|
25 | + /** |
|
26 | + * Register any events for your application. |
|
27 | + * |
|
28 | + * @return void |
|
29 | + */ |
|
30 | + public function boot() |
|
31 | + { |
|
32 | + parent::boot(); |
|
33 | 33 | |
34 | - // |
|
35 | - } |
|
34 | + // |
|
35 | + } |
|
36 | 36 | } |
@@ -6,83 +6,83 @@ |
||
6 | 6 | |
7 | 7 | class Kernel extends HttpKernel |
8 | 8 | { |
9 | - /** |
|
10 | - * The application's global HTTP middleware stack. |
|
11 | - * |
|
12 | - * These middleware are run during every request to your application. |
|
13 | - * |
|
14 | - * @var array |
|
15 | - */ |
|
16 | - protected $middleware = [ |
|
17 | - \Fruitcake\Cors\HandleCors::class, |
|
18 | - \App\Http\Middleware\TrustProxies::class, |
|
19 | - \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, |
|
20 | - \App\Http\Middleware\TrimStrings::class, |
|
21 | - \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, |
|
22 | - ]; |
|
9 | + /** |
|
10 | + * The application's global HTTP middleware stack. |
|
11 | + * |
|
12 | + * These middleware are run during every request to your application. |
|
13 | + * |
|
14 | + * @var array |
|
15 | + */ |
|
16 | + protected $middleware = [ |
|
17 | + \Fruitcake\Cors\HandleCors::class, |
|
18 | + \App\Http\Middleware\TrustProxies::class, |
|
19 | + \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, |
|
20 | + \App\Http\Middleware\TrimStrings::class, |
|
21 | + \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, |
|
22 | + ]; |
|
23 | 23 | |
24 | - /** |
|
25 | - * The application's route middleware groups. |
|
26 | - * |
|
27 | - * @var array |
|
28 | - */ |
|
29 | - protected $middlewareGroups = [ |
|
30 | - 'web' => [ |
|
31 | - \App\Http\Middleware\EncryptCookies::class, |
|
32 | - \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, |
|
33 | - \Illuminate\Session\Middleware\StartSession::class, |
|
34 | - // \Illuminate\Session\Middleware\AuthenticateSession::class, |
|
35 | - \Illuminate\View\Middleware\ShareErrorsFromSession::class, |
|
36 | - \App\Http\Middleware\VerifyCsrfToken::class, |
|
37 | - \Illuminate\Routing\Middleware\SubstituteBindings::class, |
|
38 | - 'etag' |
|
39 | - ], |
|
24 | + /** |
|
25 | + * The application's route middleware groups. |
|
26 | + * |
|
27 | + * @var array |
|
28 | + */ |
|
29 | + protected $middlewareGroups = [ |
|
30 | + 'web' => [ |
|
31 | + \App\Http\Middleware\EncryptCookies::class, |
|
32 | + \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, |
|
33 | + \Illuminate\Session\Middleware\StartSession::class, |
|
34 | + // \Illuminate\Session\Middleware\AuthenticateSession::class, |
|
35 | + \Illuminate\View\Middleware\ShareErrorsFromSession::class, |
|
36 | + \App\Http\Middleware\VerifyCsrfToken::class, |
|
37 | + \Illuminate\Routing\Middleware\SubstituteBindings::class, |
|
38 | + 'etag' |
|
39 | + ], |
|
40 | 40 | |
41 | - 'api' => [ |
|
42 | - 'throttle:60,1', |
|
43 | - \Illuminate\Routing\Middleware\SubstituteBindings::class, |
|
44 | - \App\Modules\Core\Http\Middleware\SetSessions::class, |
|
45 | - \App\Modules\Core\Http\Middleware\CheckPermissions::class, |
|
46 | - \App\Modules\Core\Http\Middleware\UpdateLocaleAndTimezone::class, |
|
47 | - \App\Modules\Core\Http\Middleware\SetRelations::class, |
|
48 | - 'etag' |
|
49 | - ], |
|
50 | - ]; |
|
41 | + 'api' => [ |
|
42 | + 'throttle:60,1', |
|
43 | + \Illuminate\Routing\Middleware\SubstituteBindings::class, |
|
44 | + \App\Modules\Core\Http\Middleware\SetSessions::class, |
|
45 | + \App\Modules\Core\Http\Middleware\CheckPermissions::class, |
|
46 | + \App\Modules\Core\Http\Middleware\UpdateLocaleAndTimezone::class, |
|
47 | + \App\Modules\Core\Http\Middleware\SetRelations::class, |
|
48 | + 'etag' |
|
49 | + ], |
|
50 | + ]; |
|
51 | 51 | |
52 | - /** |
|
53 | - * The application's route middleware. |
|
54 | - * |
|
55 | - * These middleware may be assigned to groups or used individually. |
|
56 | - * |
|
57 | - * @var array |
|
58 | - */ |
|
59 | - protected $routeMiddleware = [ |
|
60 | - 'auth' => \App\Http\Middleware\Authenticate::class, |
|
61 | - 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, |
|
62 | - 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class, |
|
63 | - 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, |
|
64 | - 'can' => \Illuminate\Auth\Middleware\Authorize::class, |
|
65 | - 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, |
|
66 | - 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class, |
|
67 | - 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class, |
|
68 | - 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, |
|
69 | - 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, |
|
70 | - ]; |
|
52 | + /** |
|
53 | + * The application's route middleware. |
|
54 | + * |
|
55 | + * These middleware may be assigned to groups or used individually. |
|
56 | + * |
|
57 | + * @var array |
|
58 | + */ |
|
59 | + protected $routeMiddleware = [ |
|
60 | + 'auth' => \App\Http\Middleware\Authenticate::class, |
|
61 | + 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, |
|
62 | + 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class, |
|
63 | + 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, |
|
64 | + 'can' => \Illuminate\Auth\Middleware\Authorize::class, |
|
65 | + 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, |
|
66 | + 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class, |
|
67 | + 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class, |
|
68 | + 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, |
|
69 | + 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, |
|
70 | + ]; |
|
71 | 71 | |
72 | - /** |
|
73 | - * The priority-sorted list of middleware. |
|
74 | - * |
|
75 | - * This forces non-global middleware to always be in the given order. |
|
76 | - * |
|
77 | - * @var array |
|
78 | - */ |
|
79 | - protected $middlewarePriority = [ |
|
80 | - \Illuminate\Session\Middleware\StartSession::class, |
|
81 | - \Illuminate\View\Middleware\ShareErrorsFromSession::class, |
|
82 | - \App\Http\Middleware\Authenticate::class, |
|
83 | - \Illuminate\Routing\Middleware\ThrottleRequests::class, |
|
84 | - \Illuminate\Session\Middleware\AuthenticateSession::class, |
|
85 | - \Illuminate\Routing\Middleware\SubstituteBindings::class, |
|
86 | - \Illuminate\Auth\Middleware\Authorize::class, |
|
87 | - ]; |
|
72 | + /** |
|
73 | + * The priority-sorted list of middleware. |
|
74 | + * |
|
75 | + * This forces non-global middleware to always be in the given order. |
|
76 | + * |
|
77 | + * @var array |
|
78 | + */ |
|
79 | + protected $middlewarePriority = [ |
|
80 | + \Illuminate\Session\Middleware\StartSession::class, |
|
81 | + \Illuminate\View\Middleware\ShareErrorsFromSession::class, |
|
82 | + \App\Http\Middleware\Authenticate::class, |
|
83 | + \Illuminate\Routing\Middleware\ThrottleRequests::class, |
|
84 | + \Illuminate\Session\Middleware\AuthenticateSession::class, |
|
85 | + \Illuminate\Routing\Middleware\SubstituteBindings::class, |
|
86 | + \Illuminate\Auth\Middleware\Authorize::class, |
|
87 | + ]; |
|
88 | 88 | } |
@@ -6,42 +6,42 @@ |
||
6 | 6 | |
7 | 7 | class ApiSkeletonServiceProvider extends ServiceProvider |
8 | 8 | { |
9 | - /** |
|
10 | - * Perform post-registration booting of services. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function boot() |
|
15 | - { |
|
16 | - $this->publishes([ |
|
17 | - __DIR__.'/Modules' => app_path('Modules'), |
|
18 | - __DIR__.'/Modules/Core/Resources/Assets' => base_path('public/doc/assets'), |
|
19 | - __DIR__.'/../lang' => base_path('resources/lang'), |
|
20 | - __DIR__.'/../files/Handler.php' => app_path('Exceptions/Handler.php'), |
|
21 | - __DIR__.'/../files/AuthServiceProvider.php' => app_path('Providers/AuthServiceProvider.php'), |
|
22 | - __DIR__.'/../files/BroadcastServiceProvider.php' => app_path('Providers/BroadcastServiceProvider.php'), |
|
23 | - __DIR__.'/../files/EventServiceProvider.php' => app_path('Providers/EventServiceProvider.php'), |
|
24 | - __DIR__.'/../files/Kernel.php' => app_path('Console/Kernel.php'), |
|
25 | - __DIR__.'/../files/HttpKernel.php' => app_path('Http/Kernel.php'), |
|
26 | - __DIR__.'/../files/channels.php' => base_path('routes/channels.php'), |
|
27 | - __DIR__.'/../files/Jenkinsfile' => base_path('/Jenkinsfile'), |
|
28 | - __DIR__.'/../files/phpcs.xml' => base_path('/phpcs.xml'), |
|
29 | - __DIR__.'/../files/docker' => base_path('/docker'), |
|
30 | - __DIR__.'/../files/.dockerignore' => base_path('/.dockerignore'), |
|
31 | - ]); |
|
9 | + /** |
|
10 | + * Perform post-registration booting of services. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function boot() |
|
15 | + { |
|
16 | + $this->publishes([ |
|
17 | + __DIR__.'/Modules' => app_path('Modules'), |
|
18 | + __DIR__.'/Modules/Core/Resources/Assets' => base_path('public/doc/assets'), |
|
19 | + __DIR__.'/../lang' => base_path('resources/lang'), |
|
20 | + __DIR__.'/../files/Handler.php' => app_path('Exceptions/Handler.php'), |
|
21 | + __DIR__.'/../files/AuthServiceProvider.php' => app_path('Providers/AuthServiceProvider.php'), |
|
22 | + __DIR__.'/../files/BroadcastServiceProvider.php' => app_path('Providers/BroadcastServiceProvider.php'), |
|
23 | + __DIR__.'/../files/EventServiceProvider.php' => app_path('Providers/EventServiceProvider.php'), |
|
24 | + __DIR__.'/../files/Kernel.php' => app_path('Console/Kernel.php'), |
|
25 | + __DIR__.'/../files/HttpKernel.php' => app_path('Http/Kernel.php'), |
|
26 | + __DIR__.'/../files/channels.php' => base_path('routes/channels.php'), |
|
27 | + __DIR__.'/../files/Jenkinsfile' => base_path('/Jenkinsfile'), |
|
28 | + __DIR__.'/../files/phpcs.xml' => base_path('/phpcs.xml'), |
|
29 | + __DIR__.'/../files/docker' => base_path('/docker'), |
|
30 | + __DIR__.'/../files/.dockerignore' => base_path('/.dockerignore'), |
|
31 | + ]); |
|
32 | 32 | |
33 | - $this->publishes([ |
|
34 | - __DIR__.'/../files/auth.php' => config_path('auth.php'), |
|
35 | - ], 'config'); |
|
36 | - } |
|
33 | + $this->publishes([ |
|
34 | + __DIR__.'/../files/auth.php' => config_path('auth.php'), |
|
35 | + ], 'config'); |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
39 | - * Register any package services. |
|
40 | - * |
|
41 | - * @return void |
|
42 | - */ |
|
43 | - public function register() |
|
44 | - { |
|
45 | - // |
|
46 | - } |
|
38 | + /** |
|
39 | + * Register any package services. |
|
40 | + * |
|
41 | + * @return void |
|
42 | + */ |
|
43 | + public function register() |
|
44 | + { |
|
45 | + // |
|
46 | + } |
|
47 | 47 | } |
@@ -6,29 +6,29 @@ |
||
6 | 6 | |
7 | 7 | class ModuleServiceProvider extends ServiceProvider |
8 | 8 | { |
9 | - /** |
|
10 | - * Bootstrap the module services. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function boot() |
|
15 | - { |
|
16 | - $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'reporting'); |
|
17 | - $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'reporting'); |
|
9 | + /** |
|
10 | + * Bootstrap the module services. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function boot() |
|
15 | + { |
|
16 | + $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'reporting'); |
|
17 | + $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'reporting'); |
|
18 | 18 | |
19 | - $this->loadMigrationsFrom(module_path('reporting', 'Database/Migrations', 'app')); |
|
20 | - if (!$this->app->configurationIsCached()) { |
|
21 | - $this->loadConfigsFrom(module_path('reporting', 'Config', 'app')); |
|
22 | - } |
|
23 | - } |
|
19 | + $this->loadMigrationsFrom(module_path('reporting', 'Database/Migrations', 'app')); |
|
20 | + if (!$this->app->configurationIsCached()) { |
|
21 | + $this->loadConfigsFrom(module_path('reporting', 'Config', 'app')); |
|
22 | + } |
|
23 | + } |
|
24 | 24 | |
25 | - /** |
|
26 | - * Register the module services. |
|
27 | - * |
|
28 | - * @return void |
|
29 | - */ |
|
30 | - public function register() |
|
31 | - { |
|
32 | - $this->app->register(RouteServiceProvider::class); |
|
33 | - } |
|
25 | + /** |
|
26 | + * Register the module services. |
|
27 | + * |
|
28 | + * @return void |
|
29 | + */ |
|
30 | + public function register() |
|
31 | + { |
|
32 | + $this->app->register(RouteServiceProvider::class); |
|
33 | + } |
|
34 | 34 | } |
@@ -7,25 +7,25 @@ |
||
7 | 7 | |
8 | 8 | class ReportFactory extends Factory |
9 | 9 | { |
10 | - /** |
|
11 | - * The name of the factory's corresponding model. |
|
12 | - * |
|
13 | - * @var string |
|
14 | - */ |
|
15 | - protected $model = Report::class; |
|
10 | + /** |
|
11 | + * The name of the factory's corresponding model. |
|
12 | + * |
|
13 | + * @var string |
|
14 | + */ |
|
15 | + protected $model = Report::class; |
|
16 | 16 | |
17 | - /** |
|
18 | - * Define the model's default state. |
|
19 | - * |
|
20 | - * @return array |
|
21 | - */ |
|
22 | - public function definition() |
|
23 | - { |
|
24 | - return [ |
|
25 | - 'report_name' => $this->faker->randomElement(['Users Count', 'Low Stock Products', 'Active Users']), |
|
26 | - 'view_name' => $this->faker->word(), |
|
27 | - 'created_at' => $this->faker->dateTimeBetween('-1 years', 'now'), |
|
28 | - 'updated_at' => $this->faker->dateTimeBetween('-1 years', 'now') |
|
29 | - ]; |
|
30 | - } |
|
17 | + /** |
|
18 | + * Define the model's default state. |
|
19 | + * |
|
20 | + * @return array |
|
21 | + */ |
|
22 | + public function definition() |
|
23 | + { |
|
24 | + return [ |
|
25 | + 'report_name' => $this->faker->randomElement(['Users Count', 'Low Stock Products', 'Active Users']), |
|
26 | + 'view_name' => $this->faker->word(), |
|
27 | + 'created_at' => $this->faker->dateTimeBetween('-1 years', 'now'), |
|
28 | + 'updated_at' => $this->faker->dateTimeBetween('-1 years', 'now') |
|
29 | + ]; |
|
30 | + } |
|
31 | 31 | } |