that works but what im not understanding is on this part
public function endpoints(): array
{
return [
Endpoint\Create::make()
->authenticated()
->action(function (OriginalContext $context) {
return $this->saveUserProduct($context);
}),
Endpoint\Update::make()
->authenticated(),
Endpoint\Delete::make()
->authenticated(),
Endpoint\Index::make()
->paginate()
->defaultSort('-createdAt')
->limit(30),
];
}
here i also have endpoint for update, delete, and show if i want, but for example i've tried to make a custom route in this file to return the users product (passing user id as param)
Endpoint\Create::make()
->authenticated()
->action(function (OriginalContext $context) {
return $this->saveUserProduct($context);
}),
Endpoint\Endpoint::make('get-user-products')
->route('GET', '/get-user-products/{id}')
->authenticated()
->action(function (OriginalContext $context) {
return $this->getUserProducts($context);
}),
but the endpoint not exist, so for sure i cant understand how to use it properly, also for delete and update....they are not working