Get record in custom page
Hi I want to get the record data in a custom page, I tried with $this->record but is not working, I'm using v3
My code:
<?php
namespace App\Filament\Resources\CategoryResource\Pages;
use App\Filament\Resources\CategoryResource;
use App\Models\Category;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\Pages\Page;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Repeater;
use Filament\Forms\Components\Select;
use Filament\Tables;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Model;
class ManageCategorySteps extends Page
{
protected static ?string $model = Category::class;
protected static string $resource = CategoryResource::class;
protected static string $view = 'filament.resources.category-resource.pages.manage-category-steps';
protected static ?string $title = 'Edit your Steps';
protected static ?string $recordTitleAttribute = 'record';
public function form(Form $form): Form
{
return $form
->schema([
Repeater::make('categorySteps')
->label('Category Steps')
->schema([
TextInput::make('categorySteps.name')->required(),
])
->columns(2)
])->columns(1);
}
}
<?php
namespace App\Filament\Resources\CategoryResource\Pages;
use App\Filament\Resources\CategoryResource;
use App\Models\Category;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\Pages\Page;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Repeater;
use Filament\Forms\Components\Select;
use Filament\Tables;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Model;
class ManageCategorySteps extends Page
{
protected static ?string $model = Category::class;
protected static string $resource = CategoryResource::class;
protected static string $view = 'filament.resources.category-resource.pages.manage-category-steps';
protected static ?string $title = 'Edit your Steps';
protected static ?string $recordTitleAttribute = 'record';
public function form(Form $form): Form
{
return $form
->schema([
Repeater::make('categorySteps')
->label('Category Steps')
->schema([
TextInput::make('categorySteps.name')->required(),
])
->columns(2)
])->columns(1);
}
}
2 Replies