Rick Doetinchem
Richeditor undefined error
I think replyData should be empty because it's a create record form and not an edit form?
I solved it by reading the docs once again. You should always initialize the form:
Initialize the form with $this->form->fill() in mount(). This is imperative for every form that you build, even if it doesn't have any initial data.
5 replies
show total sum by filters
I think you need summarize(): https://filamentphp.com/docs/3.x/tables/summaries
41 replies
Custom page with resource record error
Thanks Matthew! It's working but also after I deleted the use InteractsWithRecord trait. I think I used 2 separate method to retrieve the model.
I have it working with Ticket::findOrFail But how do you do this if you want to use the resolveRecord with the InteractsWithRecord trait like documented in the filament documentation on https://filamentphp.com/docs/3.x/panels/resources/custom-pages#using-a-resource-record
21 replies
Custom page with resource record error
This is my complete code:
class TicketWithComments extends Page implements HasForms
{
use InteractsWithForms;
use InteractsWithRecord;
public ?array $data = [];
public Ticket $ticket;
protected static string $resource = TicketResource::class;
protected static string $view = 'filament.app.resources.ticket-resource.pages.ticket-with-comments';
public function form(Form $form): Form
{
return $form
->schema([
TextInput::make('title')
->autofocus()
->required(),
TextInput::make('personable.full_name')
->required(),
])
->statePath('data')
->model($this->ticket);
}
public function mount($ticketId): void
{
dd($this->ticketId);
$this->ticket = Ticket::findOrFail($ticketId);
$this->form->fill($this->ticket->attributesToArray());
}
}
21 replies