© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
1 reply
Shaung Bhone

Creating with pivot attributes

I can't create pivot
value
value
when creating sku.

Sku.php

public function attributes(): BelongsToMany
{
    return $this->belongsToMany(Attribute::class, 'attribute_sku')->withPivot('value');
}
public function attributes(): BelongsToMany
{
    return $this->belongsToMany(Attribute::class, 'attribute_sku')->withPivot('value');
}

Attribute.php

public function skus(): BelongsToMany
{
    return $this->belongsToMany(Sku::class, 'attribute_sku')->withPivot('value');
}
public function skus(): BelongsToMany
{
    return $this->belongsToMany(Sku::class, 'attribute_sku')->withPivot('value');
}

SkusRelationManager.php

public function form(Form $form): Form
{
    return $form
        ->schema([
            Forms\Components\TextInput::make('sku')
                ->required()
                ->maxLength(255),
            Forms\Components\Select::make('attribute_sku')
                ->relationship('attributes', 'name'),
            Forms\Components\TextInput::make('value'),
        ]);
}
public function form(Form $form): Form
{
    return $form
        ->schema([
            Forms\Components\TextInput::make('sku')
                ->required()
                ->maxLength(255),
            Forms\Components\Select::make('attribute_sku')
                ->relationship('attributes', 'name'),
            Forms\Components\TextInput::make('value'),
        ]);
}
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Attach Pivot attributes
FilamentFFilament / ❓┊help
2y ago
Creating and updating pivot table with attributes in the relationmanager
FilamentFFilament / ❓┊help
3y ago
Save relationship with pivot attributes/columns
FilamentFFilament / ❓┊help
3y ago
Sptie Translatable Pivot Attributes
FilamentFFilament / ❓┊help
2y ago