Modifying content outside of panel

I’m not sure how to ask this question, so I haven’t found a post here that addresses this, but here’s what I’m trying to do.
In one of my blueprints, I have “status” which indicates if a product is for sale or not. It’s easy of course, to manually change the status via the panel, but since I’m doing payment through Stripe, so I’ll know when a payment has gone through via Javascript - and I’d like to automatically set a product to be not-available after sale.
Is there a development pattern/method to use when trying to do something like this?

The Page objects have write methods as well, so in a route, template, snippet, controller etc. you can use the following code:

$page->update(array('status' => $page->status() - 1));

This also works for objects that are not the current page:

$p = page('something');
$p->update(array('status' => $p->status() - 1));

You can read more about this in the cheat sheet.


@lukasbestle: You beat me to it :slightly_smiling:

@nate: You could simply call a url that is handled by a router that update the page as outlined by @lukasbestle.


That’s perfect. Thanks to you both. I’ll give it a shot!