chore: bootstrap module from working instance and add install guide
This commit is contained in:
44
models/DonationProviderConfig.php
Normal file
44
models/DonationProviderConfig.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace humhub\modules\donations\models;
|
||||
|
||||
use humhub\components\ActiveRecord;
|
||||
|
||||
class DonationProviderConfig extends ActiveRecord
|
||||
{
|
||||
public static function tableName()
|
||||
{
|
||||
return 'rescue_donation_provider_config';
|
||||
}
|
||||
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
[['contentcontainer_id'], 'required'],
|
||||
[['contentcontainer_id'], 'integer'],
|
||||
[['paypal_enabled', 'paypal_recurring_enabled', 'stripe_enabled', 'stripe_recurring_enabled', 'sandbox_mode'], 'boolean'],
|
||||
[['paypal_client_id', 'paypal_client_secret', 'paypal_webhook_id', 'stripe_publishable_key', 'stripe_secret_key', 'stripe_webhook_secret'], 'string', 'max' => 255],
|
||||
[['default_currency'], 'string', 'max' => 8],
|
||||
[['contentcontainer_id'], 'unique'],
|
||||
];
|
||||
}
|
||||
|
||||
public function beforeSave($insert)
|
||||
{
|
||||
if (!parent::beforeSave($insert)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$now = date('Y-m-d H:i:s');
|
||||
if ($insert && empty($this->created_at)) {
|
||||
$this->created_at = $now;
|
||||
}
|
||||
$this->updated_at = $now;
|
||||
|
||||
if (empty($this->default_currency)) {
|
||||
$this->default_currency = 'USD';
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user