F
Filament16mo ago
Kaan

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
Vp
Vp16mo ago
Hope you have this in route url/{record} and you can access using below code
public function mount($record): void
{
dd($record);
}
public function mount($record): void
{
dd($record);
}
Kaan
KaanOP16mo ago
Thank you very much

Did you find this page helpful?