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:
+25
-1
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user