Redirect to index after creation
I used modification when creating a record with the
handleRecordCreation function, but the function to create notifications and redirect to index doesn't work, is there a proper way to solve this? so far that's what I've done..protected function handleRecordCreation(array $data): Model
{
$create = DB::select(
'EXEC create_ticket ?, ?, ?, ?, ?, ?, ?',
[
$data['location_id'],
$data['priority_id'],
$data['type_id'],
$data['created_by'],
$data['ticket_name'],
$data['ticket_desc'],
$data['images'],
]
);
$id = DB::scalar('SELECT ' . $create[0]->Id);
return TicketHeader::find($id);
}
protected function afterCreate(): void
{
Notification::make()
->success()
->title('Ticket Created!')
->body('Trouble ticket created successfully.');
}
protected function getRedirectUrl(): string
{
return $this->getResource()::getUrl('index');
}