in livewire component
public ?Model $record = null;
public function table(Table $table): Table
{
return $table
->headerActions([
Tables\Actions\EditAction::make()
->using(function (array $data, Model $record): Model {
dump($this->record); //current main record resources
dump($record); // current component modal record selected row data
dump($data); //current form
In resources pages edit
#[On('invoiceUpdateStatus')]
public function invoiceUpdateStatus($invoice)
{
dump($this->data); //current data in form
dump($this->getRecord()) //current ori data
}inside page component
class CreateForm extends Component
{
public $resource;
public $data;
public function mount(Resource $resource)
{
$this->resource = $resource;
$this->data = $this->resource->getForm()->getState();
}
public function render()
{
return view('livewire.create-form', [
'form' => $resource->getForm(),
'data' => $this->data,
]);
}
}
#[On('invoiceUpdateStatus')]
public function invoiceUpdateStatus($invoice)
{
foreach ($this->getCachedForms() as $key => $form) {
if($key == 'mountedTableActionForm'){
$livewire = $form->getLivewire();
$currentData = $form->getState();
$statePath = $form->getStatePath();
$getdata = data_get($livewire,'mountedTableActionsData.0.terms_conditions');
dd($getdata);
data_set($livewire, 'mountedTableActionsData.0.terms_conditions', 'setvaluefoo');
}
}
}in relation manager
$livewire->getOwnerRecord()->stores()
$livewire->ownerRecord->id)->horses()->get()
$livewire->getOwnerRecord()->stores()
$livewire->ownerRecord->id)->horses()->get()
->headerActions([
->form([
Select::make('horse_id')
->label('Horse')
->relationship('horses', 'name')
->options(function (Get $get, $operation, RelationManager $livewire){
$horseAttached = Slot::find($livewire->ownerRecord->id)->horses()->get()->pluck('id')->toArray();
Leave a Reply