Load custom data (break schema and load custom model) to Schema v4

Hello guys, I have a simple page in a model, it means "view" page. I want to show a custom data (model) inner of infolist, i could not find a way how can inject a custom model inner of a Schema
<?php

use App\Models\Admin;
use App\Panel\TenantPanel\Admin\Resources\OrderResource;
use Filament\Actions\Concerns\HasAction;
use Filament\Infolists;
use Filament\Resources\Pages\ViewRecord;
use Filament\Schemas\Components\Group;
use Filament\Schemas\Schema;

class ViewOrder extends ViewRecord
{
use HasAction;

protected static string $resource = OrderResource::class;

public function infolist(Schema $schema): Schema
{
$model = Admin::first();
return $schema->components([
Infolists\Components\TextEntry::make('id'),
Group::make()->model($model)->components([
Infolists\Components\TextEntry::make('email'),
])
]);
}
}
<?php

use App\Models\Admin;
use App\Panel\TenantPanel\Admin\Resources\OrderResource;
use Filament\Actions\Concerns\HasAction;
use Filament\Infolists;
use Filament\Resources\Pages\ViewRecord;
use Filament\Schemas\Components\Group;
use Filament\Schemas\Schema;

class ViewOrder extends ViewRecord
{
use HasAction;

protected static string $resource = OrderResource::class;

public function infolist(Schema $schema): Schema
{
$model = Admin::first();
return $schema->components([
Infolists\Components\TextEntry::make('id'),
Group::make()->model($model)->components([
Infolists\Components\TextEntry::make('email'),
])
]);
}
}
for example this is Order model, first component can show id of model, but next component, i want to make a group and load seperate model and load that model I dont have relation, I dont want handle by relation, i want to know how can make a custom schema inner of a components without any relation of parent model (page record)
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?