Skip to content
This repository has been archived by the owner on May 1, 2021. It is now read-only.

Hookes not fired #9

Open
spoetnik opened this issue Mar 27, 2020 · 1 comment
Open

Hookes not fired #9

spoetnik opened this issue Mar 27, 2020 · 1 comment

Comments

@spoetnik
Copy link

spoetnik commented Mar 27, 2020

When creating a page in the api, the $wire->addHookBefore('Pages::saveReady', function($event) { } is not fired.

This is the code in my API:

`public static function addKite($data) {

RestApiHelper::checkAndSanitizeRequiredParameters($data, [
'title|string',
'body|string',
'brand|string',
]);

$title = $data->title;
$body = $data->body;
$brand = $data->brand;

// Create the kitepage
$kitePage = new Page();
$kitePage->template = 'kite';
$kitePage->parent = '/auctions';
$kitePage->of(false); // turns off output formatting

$kitePage->name = $title; // URL name
$kitePage->title = $title;
$kitePage->body = $body;
$kitePage->brand = $brand;

$kitePage->save();

return extractPageFields($kitePage, ['title', 'body', 'brand']);

}`

@thomasaull
Copy link
Owner

@spoetnik Can you try to reproduce the same behaviour in a regular php file? Is it working there?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants