diff --git a/src/Controllers/BadasoCRUDController.php b/src/Controllers/BadasoCRUDController.php index f30a6f6f..0453684e 100644 --- a/src/Controllers/BadasoCRUDController.php +++ b/src/Controllers/BadasoCRUDController.php @@ -316,7 +316,6 @@ function ($attribute, $value, $fail) { 'required', function ($attribute, $value, $fail) use ($request) { if (! Schema::hasColumn($request->name, $value)) { - $split_attribute = explode('.', $attribute); $split_attribute[2] = 'relation_type'; $field_to_relation = join('.', $split_attribute); diff --git a/src/Database/Schema/SchemaManager.php b/src/Database/Schema/SchemaManager.php index d097ebf7..3f92dd25 100644 --- a/src/Database/Schema/SchemaManager.php +++ b/src/Database/Schema/SchemaManager.php @@ -127,6 +127,7 @@ public static function describeTable($table_name) $indexType = array_values($column_array['indexes'])[0]['type']; $column_array['key'] = substr($indexType, 0, 3); } + return $column_array; }); } diff --git a/tests/Feature/BadasoApiCrudManagementTest.php b/tests/Feature/BadasoApiCrudManagementTest.php index 8185a456..d9ae1d91 100644 --- a/tests/Feature/BadasoApiCrudManagementTest.php +++ b/tests/Feature/BadasoApiCrudManagementTest.php @@ -410,7 +410,7 @@ private function createTestTables(int $max_count_table_generate) $table_names = []; for ($index = 1; $index <= $max_count_table_generate; $index++) { $table_name = "{$this->TABLE_TEST_PREFIX}{$index}"; - if (!Schema::hasTable($table_name)) { + if (! Schema::hasTable($table_name)) { Schema::create($table_name, function (Blueprint $table) use ($index, $table_names) { $table->id(); @@ -441,7 +441,7 @@ private function createTestEmptyValueTables(int $max_count_table_generate) $table_names = []; for ($index = 1; $index <= $max_count_table_generate; $index++) { $table_name = "{$this->TABLE_TEST_EMPTY_VALUE_PREFIX}{$index}"; - if (!Schema::hasTable($table_name)) { + if (! Schema::hasTable($table_name)) { Schema::create($table_name, function (Blueprint $table) use ($index, $table_names) { $table->id(); @@ -593,7 +593,6 @@ public function testAddCrudManagement() ], ]; foreach ($const_fields as $key => ['badaso_type' => $badaso_type, 'schema_type' => $schema_type, 'details' => $details]) { - if ($index_table_name == 0 && $badaso_type == 'relation') { continue; } @@ -646,7 +645,7 @@ class {$model_name} extends Model { } PHP; $model_path = app_path("Models/$model_file_name"); - if (!file_exists($model_path)) { + if (! file_exists($model_path)) { file_put_contents($model_path, $model_body); } @@ -667,7 +666,7 @@ class {$model_name} extends Model { $controller_data = []; if (rand(0, 1)) { // create new controller - $controller_name = str_replace([' ', '_'], '', ucwords($table_name)) . 'Controller'; + $controller_name = str_replace([' ', '_'], '', ucwords($table_name)).'Controller'; $controller_file_name = "{$controller_name}.php"; $controller_body = << $request_data_crud_table) { $response = CallHelperTest::withAuthorizeBearer($this)->json('POST', CallHelperTest::getUrlApiV1Prefix('/crud/add'), $request_data_crud_table); // $response->assertSuccessful(); - } - } public function testAddTableManyToMany()