Feat: Upgrading Lunar to 1.5

This commit is contained in:
2026-08-31 13:16:13 +03:00
parent 661e8b9a96
commit d873cb4931
42 changed files with 229 additions and 173 deletions
@@ -2,7 +2,7 @@
namespace Modules\Core\Catalog\Contracts;
use Filament\Forms\Components\Component;
use Filament\Schemas\Components\Component;
/**
* A Product Option Type describes how a category of Lunar `ProductOption` (e.g.
@@ -2,8 +2,8 @@
namespace Modules\Core\Catalog\Filament\Extensions;
use Filament\Schemas\Schema;
use Filament\Forms\Components\Select;
use Filament\Forms\Form;
use Illuminate\Support\Str;
use Lunar\Admin\Support\Extending\ResourceExtension;
use Modules\Core\Catalog\Services\ProductOptionTypeManager;
@@ -16,7 +16,7 @@ use Modules\Core\Catalog\Services\ProductOptionTypeManager;
*/
class ProductOptionResourceExtension extends ResourceExtension
{
public function extendForm(Form $form): Form
public function extendForm(Schema $schema): Schema
{
$options = collect(ProductOptionTypeManager::get()->all())
->keys()
@@ -24,11 +24,11 @@ class ProductOptionResourceExtension extends ResourceExtension
->all();
if ($options === []) {
return $form;
return $schema;
}
return $form->schema([
...$form->getComponents(),
return $schema->components([
...$schema->getComponents(),
Select::make('meta.option_type')
->label('Option Type')
->options($options)
@@ -2,7 +2,7 @@
namespace Modules\Core\Catalog\Filament\Extensions;
use Filament\Forms\Form;
use Filament\Schemas\Schema;
use Lunar\Admin\Support\Extending\RelationManagerExtension;
use Lunar\Models\ProductOption;
use Modules\Core\Catalog\Services\ProductOptionTypeManager;
@@ -15,7 +15,7 @@ use Modules\Core\Catalog\Services\ProductOptionTypeManager;
*/
class ValuesRelationManagerExtension extends RelationManagerExtension
{
public function extendForm(Form $form): Form
public function extendForm(Schema $schema): Schema
{
/** @var ProductOption $option */
$option = $this->caller->getOwnerRecord();
@@ -23,11 +23,11 @@ class ValuesRelationManagerExtension extends RelationManagerExtension
$type = ProductOptionTypeManager::get()->resolve($option->meta['option_type'] ?? null);
if ($type === null) {
return $form;
return $schema;
}
return $form->schema([
...$form->getComponents(),
return $schema->components([
...$schema->getComponents(),
...$type->getMetaForm(),
]);
}