diff --git a/app/Http/Requests/Setting/Module.php b/app/Http/Requests/Setting/Module.php index 82e6108ef..ea2908005 100644 --- a/app/Http/Requests/Setting/Module.php +++ b/app/Http/Requests/Setting/Module.php @@ -27,12 +27,16 @@ class Module extends FormRequest $module = module($this->request->get('module_alias')); - if ($module->get('settings')) { - foreach ($module->get('settings') as $field) { - if (isset($field['attributes']['required'])) { - $rules[$field['name']] = $field['attributes']['required']; - } + if (!$fields = $module->get('settings')) { + return $rules; + } + + foreach ($fields as $field) { + if (empty($field['rules'])) { + continue; } + + $rules[$field['name']] = $field['rules']; } return $rules; diff --git a/app/Models/Banking/Transfer.php b/app/Models/Banking/Transfer.php index 554875b9d..79cb83247 100644 --- a/app/Models/Banking/Transfer.php +++ b/app/Models/Banking/Transfer.php @@ -32,7 +32,7 @@ class Transfer extends Model public function expense_account() { - return $this->belongsTo('App\Models\Banking\Account', 'expense_transaction.account_id', 'id'); + return $this->belongsTo('App\Models\Banking\Account', 'expense_transaction.account_id', 'id')->withDefault(['name' => trans('general.na')]); } public function income_transaction() @@ -42,6 +42,6 @@ class Transfer extends Model public function income_account() { - return $this->belongsTo('App\Models\Banking\Account', 'income_transaction.account_id', 'id'); + return $this->belongsTo('App\Models\Banking\Account', 'income_transaction.account_id', 'id')->withDefault(['name' => trans('general.na')]); } } diff --git a/composer.json b/composer.json index 49cf4b320..b3995c435 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "bkwld/cloner": "3.6.*", "consoletvs/charts": "6.5.*", "doctrine/dbal": "2.9.*", - "dingo/api": "3.0.0-rc3", + "dingo/api": "3.0.*", "fideloper/proxy": "^4.2", "fruitcake/laravel-cors": "^1.0", "genealabs/laravel-model-caching": "0.8.*", diff --git a/config/services.php b/config/services.php index 2a1d616c7..f88a89335 100644 --- a/config/services.php +++ b/config/services.php @@ -30,4 +30,8 @@ return [ 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), ], + 'sendgrid' => [ + 'api_key' => env('SENDGRID_API_KEY'), + ], + ]; diff --git a/modules/PaypalStandard/module.json b/modules/PaypalStandard/module.json index ce0827c1d..fc7ed3410 100644 --- a/modules/PaypalStandard/module.json +++ b/modules/PaypalStandard/module.json @@ -20,7 +20,8 @@ "icon": "fa fa-font", "attributes": { "required": "required" - } + }, + "rules": "required|string" }, { "type": "textGroup", @@ -29,7 +30,8 @@ "icon": "envelope", "attributes": { "required": "required" - } + }, + "rules": "required|email" }, { "type": "selectGroup", @@ -40,8 +42,11 @@ "live": "Live", "sandbox": "Sandbox" }, - "selected": null, - "attributes": {} + "selected": "live", + "attributes": { + "required": "required" + }, + "rules": "required|string" }, { "type": "selectGroup", @@ -52,8 +57,11 @@ "authorization": "Authorization", "sale": "Sale" }, - "selected": null, - "attributes": {} + "selected": "sale", + "attributes": { + "required": "required" + }, + "rules": "required|string" }, { "type": "radioGroup", @@ -61,7 +69,8 @@ "title": "paypal-standard::general.form.customer", "enable": "general.yes", "disable": "general.no", - "attributes": {} + "attributes": {}, + "rules": "required|integer" }, { "type": "radioGroup", @@ -69,14 +78,16 @@ "title": "paypal-standard::general.form.debug", "enable": "general.yes", "disable": "general.no", - "attributes": {} + "attributes": {}, + "rules": "required|integer" }, { "type": "textGroup", "name": "order", "title": "paypal-standard::general.form.order", "icon": "sort", - "attributes": {} + "attributes": {}, + "rules": "nullable|integer" } ] }