Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,21 @@
"format": "vendor/bin/pint"
},
"require": {
"php": "^8.1|^8.2",
"php": "^8.2|^8.3|^8.4",
"tomatophp/console-helpers": "^1.1",
"filament/filament": "^3.2"
"filament/filament": "^3.23"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

⚠️ Potential issue

🧩 Analysis chain

Fix dependency version constraint.

The pipeline is failing because Filament 3.23 doesn't match your minimum-stability requirements.

-        "filament/filament": "^3.23"
+        "filament/filament": "^3.0"

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:

#!/bin/bash
# Check available Filament versions
composer show filament/filament --available

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:

  • File: composer.json (line 53)
-        "filament/filament": "^3.23"
+        "filament/filament": "^3.0"

This change will ensure that Composer selects a published, stable version of Filament that complies with your project's minimum-stability requirements.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"filament/filament": "^3.23"
"filament/filament": "^3.0"

},
"require-dev": {
"laravel/pint": "^1.18",
"livewire/livewire": "^2.10|^3.0",
"nunomaduro/larastan": "^2.9",
"orchestra/testbench": "^9.5",
"pestphp/pest": "^2.36",
"pestphp/pest-plugin-laravel": "^2.4",
"pestphp/pest-plugin-livewire": "^2.1",
"phpstan/extension-installer": "^1.4",
"phpstan/phpstan-deprecation-rules": "^1.2",
"phpstan/phpstan-phpunit": "^1.4"
"laravel/pint": "^1.21",
"livewire/livewire": "^2.10|^3.0",
"nunomaduro/larastan": "^3.1",
"orchestra/testbench": "^10.0",
"pestphp/pest": "^3.7",
"pestphp/pest-plugin-laravel": "^3.1",
"pestphp/pest-plugin-livewire": "^3.0",
"phpstan/extension-installer": "^1.4",
"phpstan/phpstan-deprecation-rules": "^2.0",
"phpstan/phpstan-phpunit": "^2.0"
},
"version": "v1.0.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
public function up(): void
{
Schema::create('categories', function (Blueprint $table) {
$table->id();

$table->unsignedBigInteger('team_id')->nullable()->after('id');
$table->foreign('team_id')->references('id')->on('teams')->onDelete('cascade');

$table->foreignId('parent_id')->nullable()->references('id')->on('categories')->onDelete('cascade');
$table->string('for')->default('posts')->nullable();
$table->string('type')->default('category')->nullable();
Expand All @@ -37,10 +37,8 @@ public function up()

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
public function down(): void
{
Schema::dropIfExists('categories');
}
Expand Down
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');
}
};
8 changes: 8 additions & 0 deletions resources/lang/ar/messages.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@
'show_in_menu' => 'إظهار في القائمة',
],
],
"images" => [
"title" => "الصور",
"description" => "إعدادات الصور",
"columns" => [
"feature_image" => "صورة مميزة",
"cover_image" => "صورة الغلاف",
]
],
],
],
];
8 changes: 8 additions & 0 deletions resources/lang/en/messages.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@
'show_in_menu' => 'Show In Menu',
],
],
"images" => [
"title" => "Images",
"description" => "Images settings",
"columns" => [
"feature_image" => "Feature Image",
"cover_image" => "Cover Image",
]
],
],
],
];
91 changes: 91 additions & 0 deletions src/Filament/Resources/CategoriesMetaResource.php
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
Copy link

Choose a reason for hiding this comment

The 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

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
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')
Forms\Components\TextInput::make('model_id')
->numeric(),
Forms\Components\TextInput::make('model_type')
->maxLength(255),
Forms\Components\Select::make('category_id')
->relationship('category', 'name')
->required()
->searchable(),
Forms\Components\TextInput::make('key')

->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(),
];
}
}
Loading
Loading