fail([StarterResponseCode::START_ERROR_BUSINESS, '表名不存在']); } $customForm = CustomForm::with(['relation' => function ($query) { $query->whereNotNull('link_table_name'); }])->with('fields')->where('table_name', $tableName)->first(); if (empty($customForm)) { return $this->fail([StarterResponseCode::START_ERROR_BUSINESS, '自定义表不存在']); } $realTable = Schema::hasTable($tableName); if (!$realTable) { return $this->fail([StarterResponseCode::START_ERROR_BUSINESS, '实体表不存在']); } $request->merge(['customForm' => $customForm]); $request->merge(['customFormFields' => $customForm->fields]); return $next($request); } }