My case is I am running a site with 4 multisite, and each site can make a stripe payment.
I added the active site siteId to the Stripe payload so that I can grab it back inside my stripe webhook. However i cant set the site_id to my model easily:
using the method ::create totaly ignore the value
using $instance->site_id = $siteId; $instance->save() does not work
using $instance->site_id = $siteId; $instance->forceSave() does not work
only - using $instance->site_id = $siteId; $instance->saveQuietly() does work
I’m curious if I am doing things wrong or if there is a better way?
/**
* UserSubscription Model
*/
class UserSubscription extends Model
{
use \October\Rain\Database\Traits\Validation;
use \October\Rain\Database\Traits\Multisite;
/**
* @var array Attributes that can be propagated across sites
*/
protected $propagatable = [];
...
}
This is likely because the site_id is set automatically by the internal events (set in the Multisite trait). Can you show me the code you are using that wants to set the site_id?
Yes, we’ll need to check if it has been set externally (as above) and use that value, rather than setting the site ID directly from the site management context.
Originally, you were expected to call this, ratner than set it on the model: