@@ -27,11 +27,11 @@ discard block |
||
| 27 | 27 | * @param $request Request |
| 28 | 28 | * @throws \Illuminate\Validation\ValidationException |
| 29 | 29 | */ |
| 30 | - public function _handleValidation($table, $method, $request){ |
|
| 30 | + public function _handleValidation($table, $method, $request) { |
|
| 31 | 31 | |
| 32 | - $validation = config("mock.entrypoints.".$table.".".$method."_validation"); |
|
| 32 | + $validation = config("mock.entrypoints." . $table . "." . $method . "_validation"); |
|
| 33 | 33 | |
| 34 | - if (config("mock.force_json") || config("mock.entrypoints.".$table.".".$method."_force_json")) { |
|
| 34 | + if (config("mock.force_json") || config("mock.entrypoints." . $table . "." . $method . "_force_json")) { |
|
| 35 | 35 | $request->server->set('HTTP_ACCEPT', 'application/json'); |
| 36 | 36 | $request->headers = new HeaderBag($request->server->getHeaders()); |
| 37 | 37 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | { |
| 61 | 61 | $this->_handleValidation($table, "index", $request); |
| 62 | 62 | |
| 63 | - $entity = config("mock.entrypoints.".$table); |
|
| 63 | + $entity = config("mock.entrypoints." . $table); |
|
| 64 | 64 | |
| 65 | 65 | if ($entity) { |
| 66 | 66 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | $data = factory($entity["class"], $entity["number"])->states($entity["states"])->make($entity["override"]); |
| 71 | 71 | |
| 72 | - $data = $data->map(function ($item, $key) { |
|
| 72 | + $data = $data->map(function($item, $key) { |
|
| 73 | 73 | |
| 74 | 74 | if (!$item["id"]) { |
| 75 | 75 | $item['id'] = $key + 1; |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | $currentPageItems = $itemCollection->slice(($currentPage * $perPage) - $perPage, $perPage)->values()->all(); |
| 121 | 121 | |
| 122 | 122 | // Create our paginator and pass it to the view |
| 123 | - $paginatedItems= new LengthAwarePaginator($currentPageItems , count($itemCollection), $perPage); |
|
| 123 | + $paginatedItems = new LengthAwarePaginator($currentPageItems, count($itemCollection), $perPage); |
|
| 124 | 124 | |
| 125 | 125 | // set url path for generted links |
| 126 | 126 | $paginatedItems->setPath($request->url()); |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | { |
| 167 | 167 | $this->_handleValidation($table, "update", $request); |
| 168 | 168 | |
| 169 | - $folder = public_path(Mock::getPath() ."/". $table); |
|
| 169 | + $folder = public_path(Mock::getPath() . "/" . $table); |
|
| 170 | 170 | |
| 171 | 171 | if (!is_dir($folder)) { |
| 172 | 172 | \File::makeDirectory($folder, 493, true); |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | { |
| 195 | 195 | $this->_handleValidation($table, "view", $request); |
| 196 | 196 | |
| 197 | - $entity = config("mock.entrypoints.".$table); |
|
| 197 | + $entity = config("mock.entrypoints." . $table); |
|
| 198 | 198 | |
| 199 | 199 | if ($entity) { |
| 200 | 200 | |
@@ -3,7 +3,7 @@ |
||
| 3 | 3 | use Blok\Mock\Mock; |
| 4 | 4 | |
| 5 | 5 | if (Mock::meetEnvCondition()) { |
| 6 | - Route::group(["namespace" => "Blok\\Mock\\Http\\Controllers"], function () { |
|
| 6 | + Route::group(["namespace" => "Blok\\Mock\\Http\\Controllers"], function() { |
|
| 7 | 7 | Route::post(config("mock.route") . '/{table}', 'MockController@store'); |
| 8 | 8 | Route::any(config("mock.route") . '/{table}/create', 'MockController@store'); |
| 9 | 9 | Route::get(config("mock.route") . '/{table}', 'MockController@index'); |