public function tests(): BelongsToMany { return $this->belongsToMany(Test::class, 'company_test') ->withPivot('cash_price', 'sponsor_price', 'hc_price', 'transport_price', 'is_active') ->withTimestamps(); }
public function companies(): BelongsToMany { return $this->belongsToMany(Company::class, 'company_test') ->withPivot('cash_price', 'sponsor_price', 'hc_price', 'transport_price', 'is_active') ->withTimestamps(); }
Tables\Columns\ToggleColumn::make('is_active') ->label('Active') ->action(function (array $data) { \Log::error('Toggle action triggered', $data); $this->company->tests()->updateExistingPivot($data['test_id'], ['is_active' => $data['is_active']]); }),