Skip to main content

Custom fill

Introduction

By default, Qore will manage creating and updating your models automatically. Besides that, it will also make activity logs for creation and mutations.

In some cases, you want to do this manually.

The customFill method

You can achieve customizing it by adding the following method to your resource:

public function customFill(Request $request, ?Model $original = null): Model|bool

If this method returns an instance of a Model, all of Qore's automation will be disabled.

An example:

    public function customFill(Request $request, ?Model $original = null): Model|bool
{
$model = $this->invoiceBuilder($request, $original)->save();

/**
* If we should directly send the invoice
*/
if (setting('qore/invoicing', 'invoicing_send_mode') === InvoicingSendMode::ALWAYS->value) {
(new InvoiceSender($model))->send();
}

return $model;
}