Error in Action: "$ownerRecord must not be accessed before initialization"
Hello,
I'm trying to access livewire->ownerRecord inside an action but i'm getting the error in the title.
Here is my code
I'm trying to access livewire->ownerRecord inside an action but i'm getting the error in the title.
Here is my code
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('id')->sortable(),
Tables\Columns\TextColumn::make('seller.organization')->sortable(),
Tables\Columns\TextColumn::make('lead_time_value')->sortable(),
Tables\Columns\TextColumn::make('lead_time_unit')->sortable(),
Tables\Columns\TextColumn::make('quote')->sortable(),
])
->filters([
//
])
->headerActions([])
->actions([
Action::make('assign')
->label('Assign')
->action(function (Quote $quote, RelationManager $livewire) use ($table) {
dd($livewire->ownerRecord);
OrderItem::find(self::$order_item_id)->assign($quote);
})
])
->bulkActions([]);
} public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('id')->sortable(),
Tables\Columns\TextColumn::make('seller.organization')->sortable(),
Tables\Columns\TextColumn::make('lead_time_value')->sortable(),
Tables\Columns\TextColumn::make('lead_time_unit')->sortable(),
Tables\Columns\TextColumn::make('quote')->sortable(),
])
->filters([
//
])
->headerActions([])
->actions([
Action::make('assign')
->label('Assign')
->action(function (Quote $quote, RelationManager $livewire) use ($table) {
dd($livewire->ownerRecord);
OrderItem::find(self::$order_item_id)->assign($quote);
})
])
->bulkActions([]);
}