Aziz Trabelsi
Aziz Trabelsi
FFilament
Created by Aziz Trabelsi on 1/18/2025 in #❓┊help
ToggleColumn don't update the pivot table
I have 2 tables that they have a BelongsToMany relationship like in below
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 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();
}
public function companies(): BelongsToMany
{
return $this->belongsToMany(Company::class, 'company_test')
->withPivot('cash_price', 'sponsor_price', 'hc_price', 'transport_price', 'is_active')
->withTimestamps();
}
My ToggleColumn is like this:
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']]);
}),
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']]);
}),
Even the log not shown in the log. I need to to update is_active in the pivot table but it keep updating in tests table. Any help please ?
1 replies
FFilament
Created by Aziz Trabelsi on 12/1/2024 in #❓┊help
How can save each step of a Wizard form when on next button ?
Hello everyone, I created a Wizard form and i need to save each step on clicking on next button. Any help please ?
6 replies