chore: bootstrap module from working instance and add install guide
This commit is contained in:
43
models/DonationWebhookEvent.php
Normal file
43
models/DonationWebhookEvent.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace humhub\modules\donations\models;
|
||||
|
||||
use humhub\components\ActiveRecord;
|
||||
|
||||
class DonationWebhookEvent extends ActiveRecord
|
||||
{
|
||||
public static function tableName()
|
||||
{
|
||||
return 'rescue_donation_webhook_event';
|
||||
}
|
||||
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
[['provider', 'provider_event_id'], 'required'],
|
||||
[['is_processed'], 'integer'],
|
||||
[['payload_json'], 'string'],
|
||||
[['provider'], 'string', 'max' => 32],
|
||||
[['provider_event_id'], 'string', 'max' => 190],
|
||||
[['event_type'], 'string', 'max' => 120],
|
||||
[['provider', 'provider_event_id'], 'unique', 'targetAttribute' => ['provider', 'provider_event_id']],
|
||||
];
|
||||
}
|
||||
|
||||
public function beforeSave($insert)
|
||||
{
|
||||
if (!parent::beforeSave($insert)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($insert && empty($this->created_at)) {
|
||||
$this->created_at = date('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
if ($this->is_processed === null) {
|
||||
$this->is_processed = 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user