Add Menu Tree functionality and integrate Filament Tree plugin: Introduced a new MenuTree page for managing page structures, added PagesMenuWidget for displaying a tree layout of pages, and updated localization files for menu-related actions. Enhanced Page model with tree management capabilities and included necessary CSS and JS files for the Filament Tree plugin.

This commit is contained in:
Ümit Tunç
2025-11-01 16:13:59 -03:00
parent 1d46c9243d
commit ad20ba575a
13 changed files with 342 additions and 2 deletions
+25 -1
View File
@@ -7,10 +7,11 @@ use App\Traits\HasTranslations;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use SolutionForest\FilamentTree\Concern\ModelTree;
class Page extends Model
{
use HasFactory, SoftDeletes, HasTranslations;
use HasFactory, SoftDeletes, HasTranslations, ModelTree;
protected $fillable = [
'title',
@@ -172,4 +173,27 @@ class Page extends Model
];
})->filter(fn($section) => $section['template'] !== null);
}
/**
* ModelTree - Custom column names
*/
public function determineOrderColumnName(): string
{
return 'sort_order';
}
public function determineParentColumnName(): string
{
return 'parent_id';
}
public function determineTitleColumnName(): string
{
return 'title';
}
public static function defaultParentKey()
{
return null; // Mevcut migration nullable olduğu için null kullanıyoruz
}
}