You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, So I have been thinking of adding two additional fields to products- (Meta description and keywords). After reading through the documentation, a slot is the best approach I can take. However, I have not been able to retrieve the data from the component and save it while saving the product. See my implementation below
Slot component class
`<?php
namespace App\Http\Livewire\Admin\Product;
use Livewire\Component;
use Lunar\Hub\Slots\AbstractSlot;
use Lunar\Hub\Slots\Traits\HubSlot;
class SeoAddition extends Component implements AbstractSlot
{
use HubSlot;
public $description;
public $keywords;
public static function getName()
{
return 'hub.components.products.slots.seo-slot';
}
public function updatingDescription($val){
$this->saveSlotData(['description' => $val]);
}
public function getSlotHandle()
{
return 'seo-slot';
}
public function getSlotInitialValue()
{
return [
'description' => $this->description,
'keywords' => $this->keywords,
];
}
public function getSlotPosition()
{
return 'bottom';
}
public function getSlotTitle()
{
return '';
}
public function updateSlotModel()
{
dd($this->meta_description);
}
public function handleSlotSave($model, $data)
{
$this->slotModel = $model;
dd($data);
}
public function render()
{
return view('livewire.admin.product.seo-addition');
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi, So I have been thinking of adding two additional fields to products- (Meta description and keywords). After reading through the documentation, a slot is the best approach I can take. However, I have not been able to retrieve the data from the component and save it while saving the product. See my implementation below
Slot component class
`<?php
namespace App\Http\Livewire\Admin\Product;
use Livewire\Component;
use Lunar\Hub\Slots\AbstractSlot;
use Lunar\Hub\Slots\Traits\HubSlot;
class SeoAddition extends Component implements AbstractSlot
{
use HubSlot;
}
Slot component file
Beta Was this translation helpful? Give feedback.
All reactions