diff --git a/app/Http/Controllers/Admin/CompanyController.php b/app/Http/Controllers/Admin/CompanyController.php index 9464157..a30f203 100644 --- a/app/Http/Controllers/Admin/CompanyController.php +++ b/app/Http/Controllers/Admin/CompanyController.php @@ -55,7 +55,7 @@ class CompanyController extends BaseController public function index() { $all = request()->all(); - $list = $this->model->withCount('emailRecords')->where(function ($query) use ($all) { + $list = $this->model->with('users')->where(function ($query) use ($all) { if (isset($all['filter']) && !empty($all['filter'])) { foreach ($all['filter'] as $condition) { $key = $condition['key'] ?? null; @@ -148,7 +148,7 @@ class CompanyController extends BaseController if ($validator->fails()) { return $this->fail([ResponseCode::ERROR_PARAMETER, implode(',', $validator->errors()->all())]); } - $detail = $this->model->withCount('emailRecords')->find($all['id']); + $detail = $this->model->with('users')->find($all['id']); return $this->success($detail); } @@ -165,6 +165,7 @@ class CompanyController extends BaseController * @OA\Parameter(name="company_scale", in="query", @OA\Schema(type="string", nullable=true), description="企业规模"), * @OA\Parameter(name="company_date", in="query", @OA\Schema(type="string", format="date", nullable=true), description="成立时间"), * @OA\Parameter(name="company_legal_representative", in="query", @OA\Schema(type="string", nullable=true), description="法人代表"), + * @OA\Parameter(name="company_shareholder", in="query", @OA\Schema(type="string", nullable=true), description="股东信息"), * @OA\Parameter(name="management_platform", in="query", @OA\Schema(type="string", nullable=true), description="管理平台"), * @OA\Parameter(name="project_manager", in="query", @OA\Schema(type="string", nullable=true), description="项目经理"), * @OA\Parameter(name="market_value", in="query", @OA\Schema(type="integer", format="int64", nullable=true), description="市值"), diff --git a/app/Models/Company.php b/app/Models/Company.php index 843d6c0..61828b1 100644 --- a/app/Models/Company.php +++ b/app/Models/Company.php @@ -4,5 +4,9 @@ namespace App\Models; class Company extends SoftDeletesModel { + public function users() + { + return $this->hasMany(User::class, 'company_id', 'id'); + } } diff --git a/database/migrations/2025_07_17_162734_create_companies_table.php b/database/migrations/2025_07_17_162734_create_companies_table.php index 3597c0f..7bab308 100644 --- a/database/migrations/2025_07_17_162734_create_companies_table.php +++ b/database/migrations/2025_07_17_162734_create_companies_table.php @@ -43,6 +43,8 @@ return new class extends Migration { // 是否校友企业 $table->boolean('is_schoolmate')->nullable()->comment('是否校友企业-0非校友1校友'); $table->boolean('company_need_fund')->nullable()->comment('公司是否需要融资-0否1是'); + // 股东信息 + $table->string('company_shareholder')->nullable()->comment('股东信息'); $table->string('company_industry')->nullable()->comment('公司所属行业'); $table->text('company_introduce')->nullable()->comment('公司简介');