-
-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
first commit 🔥 #2
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
*/ | ||
public function up(): void | ||
{ | ||
Schema::create('category_metas', function (Blueprint $table) { | ||
$table->id(); | ||
|
||
$table->unsignedBigInteger('model_id')->nullable(); | ||
$table->string('model_type')->nullable(); | ||
|
||
$table->foreignId('category_id')->references('id')->on('categories')->onDelete('cascade'); | ||
|
||
$table->string('key')->index(); | ||
$table->json('value')->nullable(); | ||
|
||
$table->timestamps(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
*/ | ||
public function down(): void | ||
{ | ||
Schema::dropIfExists('category_metas'); | ||
} | ||
}; |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,91 @@ | ||||||||||||||||||||||||||||||||||||
<?php | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
namespace TomatoPHP\FilamentCategories\Filament\Resources; | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
use TomatoPHP\FilamentCategories\Filament\Resources\CategoriesMetaResource\Pages; | ||||||||||||||||||||||||||||||||||||
use TomatoPHP\FilamentCategories\Filament\Resources\CategoriesMetaResource\RelationManagers; | ||||||||||||||||||||||||||||||||||||
use TomatoPHP\FilamentCategories\Models\CategoriesMeta; | ||||||||||||||||||||||||||||||||||||
use Filament\Forms; | ||||||||||||||||||||||||||||||||||||
use Filament\Forms\Form; | ||||||||||||||||||||||||||||||||||||
use Filament\Resources\Resource; | ||||||||||||||||||||||||||||||||||||
use Filament\Tables; | ||||||||||||||||||||||||||||||||||||
use Filament\Tables\Table; | ||||||||||||||||||||||||||||||||||||
use Illuminate\Database\Eloquent\Builder; | ||||||||||||||||||||||||||||||||||||
use Illuminate\Database\Eloquent\SoftDeletingScope; | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
class CategoriesMetaResource extends Resource | ||||||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||||||
protected static ?string $model = CategoriesMeta::class; | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
public static function form(Form $form): Form | ||||||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||||||
return $form | ||||||||||||||||||||||||||||||||||||
->schema([ | ||||||||||||||||||||||||||||||||||||
Forms\Components\TextInput::make('model_id') | ||||||||||||||||||||||||||||||||||||
->numeric(), | ||||||||||||||||||||||||||||||||||||
Forms\Components\TextInput::make('model_type') | ||||||||||||||||||||||||||||||||||||
->maxLength(255), | ||||||||||||||||||||||||||||||||||||
Forms\Components\TextInput::make('category_id') | ||||||||||||||||||||||||||||||||||||
->required() | ||||||||||||||||||||||||||||||||||||
->numeric(), | ||||||||||||||||||||||||||||||||||||
Forms\Components\TextInput::make('key') | ||||||||||||||||||||||||||||||||||||
Comment on lines
+26
to
+33
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Replace numeric inputs with relationship selectors. The current form uses basic text inputs for IDs. Using relationship selectors would improve the user experience and data integrity. Forms\Components\TextInput::make('model_id')
->numeric(),
Forms\Components\TextInput::make('model_type')
->maxLength(255),
-Forms\Components\TextInput::make('category_id')
- ->required()
- ->numeric(),
+Forms\Components\Select::make('category_id')
+ ->relationship('category', 'name')
+ ->required()
+ ->searchable(), 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||
->required() | ||||||||||||||||||||||||||||||||||||
->maxLength(255), | ||||||||||||||||||||||||||||||||||||
Forms\Components\TextInput::make('value'), | ||||||||||||||||||||||||||||||||||||
]); | ||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
public static function table(Table $table): Table | ||||||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||||||
return $table | ||||||||||||||||||||||||||||||||||||
->columns([ | ||||||||||||||||||||||||||||||||||||
Tables\Columns\TextColumn::make('model_id') | ||||||||||||||||||||||||||||||||||||
->numeric() | ||||||||||||||||||||||||||||||||||||
->sortable(), | ||||||||||||||||||||||||||||||||||||
Tables\Columns\TextColumn::make('model_type') | ||||||||||||||||||||||||||||||||||||
->searchable(), | ||||||||||||||||||||||||||||||||||||
Tables\Columns\TextColumn::make('category_id') | ||||||||||||||||||||||||||||||||||||
->numeric() | ||||||||||||||||||||||||||||||||||||
->sortable(), | ||||||||||||||||||||||||||||||||||||
Tables\Columns\TextColumn::make('key') | ||||||||||||||||||||||||||||||||||||
->searchable(), | ||||||||||||||||||||||||||||||||||||
Tables\Columns\TextColumn::make('created_at') | ||||||||||||||||||||||||||||||||||||
->dateTime() | ||||||||||||||||||||||||||||||||||||
->sortable() | ||||||||||||||||||||||||||||||||||||
->toggleable(isToggledHiddenByDefault: true), | ||||||||||||||||||||||||||||||||||||
Tables\Columns\TextColumn::make('updated_at') | ||||||||||||||||||||||||||||||||||||
->dateTime() | ||||||||||||||||||||||||||||||||||||
->sortable() | ||||||||||||||||||||||||||||||||||||
->toggleable(isToggledHiddenByDefault: true), | ||||||||||||||||||||||||||||||||||||
]) | ||||||||||||||||||||||||||||||||||||
->filters([ | ||||||||||||||||||||||||||||||||||||
// | ||||||||||||||||||||||||||||||||||||
]) | ||||||||||||||||||||||||||||||||||||
->actions([ | ||||||||||||||||||||||||||||||||||||
Tables\Actions\EditAction::make(), | ||||||||||||||||||||||||||||||||||||
]) | ||||||||||||||||||||||||||||||||||||
->bulkActions([ | ||||||||||||||||||||||||||||||||||||
Tables\Actions\BulkActionGroup::make([ | ||||||||||||||||||||||||||||||||||||
Tables\Actions\DeleteBulkAction::make(), | ||||||||||||||||||||||||||||||||||||
]), | ||||||||||||||||||||||||||||||||||||
]); | ||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
public static function getRelations(): array | ||||||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||||||
return [ | ||||||||||||||||||||||||||||||||||||
// | ||||||||||||||||||||||||||||||||||||
]; | ||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
public static function getPages(): array | ||||||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||||||
return [ | ||||||||||||||||||||||||||||||||||||
'index' => Pages\ListCategoriesMetas::route('/'), | ||||||||||||||||||||||||||||||||||||
'create' => Pages\CreateCategoriesMeta::route('/create'), | ||||||||||||||||||||||||||||||||||||
'edit' => Pages\EditCategoriesMeta::route('/{record}/edit'), | ||||||||||||||||||||||||||||||||||||
]; | ||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
namespace TomatoPHP\FilamentCategories\Filament\Resources\CategoriesMetaResource\Pages; | ||
|
||
use TomatoPHP\FilamentCategories\Filament\Resources\CategoriesMetaResource; | ||
use Filament\Actions; | ||
use Filament\Resources\Pages\CreateRecord; | ||
|
||
class CreateCategoriesMeta extends CreateRecord | ||
{ | ||
protected static string $resource = CategoriesMetaResource::class; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace TomatoPHP\FilamentCategories\Filament\Resources\CategoriesMetaResource\Pages; | ||
|
||
use TomatoPHP\FilamentCategories\Filament\Resources\CategoriesMetaResource; | ||
use Filament\Actions; | ||
use Filament\Resources\Pages\EditRecord; | ||
|
||
class EditCategoriesMeta extends EditRecord | ||
{ | ||
protected static string $resource = CategoriesMetaResource::class; | ||
|
||
protected function getHeaderActions(): array | ||
{ | ||
return [ | ||
Actions\DeleteAction::make(), | ||
]; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace TomatoPHP\FilamentCategories\Filament\Resources\CategoriesMetaResource\Pages; | ||
|
||
use TomatoPHP\FilamentCategories\Filament\Resources\CategoriesMetaResource; | ||
use Filament\Actions; | ||
use Filament\Resources\Pages\ListRecords; | ||
|
||
class ListCategoriesMetas extends ListRecords | ||
{ | ||
protected static string $resource = CategoriesMetaResource::class; | ||
|
||
protected function getHeaderActions(): array | ||
{ | ||
return [ | ||
Actions\CreateAction::make(), | ||
]; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Fix dependency version constraint.
The pipeline is failing because Filament 3.23 doesn't match your minimum-stability requirements.
The error suggests that version 3.23 might not be released yet or requires a development stability flag. Consider using a more conservative version constraint or adjusting the stability requirements in composer.json.
🏁 Script executed:
Length of output: 11555
Action Required: Update Filament Dependency Constraint
Based on the output from the composer command, it’s clear that no stable release matching the "^3.23" constraint exists. The available stable versions (like v3.3.0 and others in the 3.x series) fall under a constraint such as "^3.0". The pipeline issue arises because "^3.23" forces Composer to look for a version that isn’t available without additional stability flags.
Please update the dependency in
composer.json
accordingly:composer.json
(line 53)This change will ensure that Composer selects a published, stable version of Filament that complies with your project's minimum-stability requirements.
📝 Committable suggestion