Parthiban N
how to make $shouldRollbackDatabaseTransaction to true in Halt class
In BasePage class:
protected function halt(): void
{
throw new Halt();
}
-----------------------------------------------------------
In CreateRecord class -> create method -> Halt Catch block:
$exception->shouldRollbackDatabaseTransaction() ?
$this->rollBackDatabaseTransaction() :
$this->commitDatabaseTransaction();
return;
------------------------------------------------------------
In Customer Resource -> CreateCustomer Page Class :
protected ?bool $hasDatabaseTransactions = true;
handleRecordCreation method:
$record = static::getModel()::create($data);
if (! $record) {
app('helpers')::toast(
title: __('customer.error_message.create'),
color: 'danger'
);
$this->halt();
}
--------------------------------------------------------------
here how to rollback the transaction if halt hits
2 replies
Custom Table repeatable entry
i am creating custom table repeatable entry for my own project and i referred the source code of awcodes/table-repeater and taken the code from it.
https://gist.github.com/ParthiBarath/22ada1130eeeaafa323b1d2b35b3a4cb
Here i shared my custom table repeatable entry codes it works perfectly.
But i actually i want table footers with sum of the columns so i created the Footer Class with the reference of awcodes/table-repeater Header class.
But for the sum of the columns i extends the Footer class with Filament\Support\Components\Component; and i chained method default with closure and try to access the getState in blade file i end up with laravel error page
https://flareapp.io/share/x5M4dJb7
2 replies