6
0
Fork 0
jiqu-library-server/app/Admin/Forms/Settings/Unipush.php

51 lines
1.9 KiB
PHP

<?php
namespace App\Admin\Forms\Settings;
use App\Models\Setting;
use Dcat\Admin\Widgets\Form;
use Illuminate\Support\Arr;
class Unipush extends Form
{
/**
* Handle the form request.
*
* @param array $input
*
* @return mixed
*/
public function handle(array $input)
{
Setting::where('key', 'unipush')->updateOrCreate([
'key' => 'unipush',
], ['value' => $input]);
return $this
->response()
->success('配置更新成功!')
->refresh();
}
/**
* Build a form here.
*/
public function form()
{
$appSettings = Setting::where('key', 'unipush')->first();
$this->switch('is_use', '是否启用')->value(Arr::get($appSettings?->value, 'is_use', 0));
$this->text('mall_app_id', '商城APP_ID')->value(Arr::get($appSettings?->value, 'mall_app_id', ''));
$this->text('mall_app_key', '商城APP_KEY')->value(Arr::get($appSettings?->value, 'mall_app_key', ''));
$this->text('mall_app_secret', '商城APP_SECRET')->value(Arr::get($appSettings?->value, 'mall_app_secret', ''));
$this->text('mall_master_secret', '商城APP_MASTER_SECRET')->value(Arr::get($appSettings?->value, 'mall_master_secret', ''));
$this->divider();
$this->switch('merchant_is_use', '是否启用')->value(Arr::get($appSettings?->value, 'merchant_is_use', 0));
$this->text('merchant_app_id', '商户APP_ID')->value(Arr::get($appSettings?->value, 'merchant_app_id', ''));
$this->text('merchant_app_key', '商户APP_KEY')->value(Arr::get($appSettings?->value, 'merchant_app_key', ''));
$this->text('merchant_app_secret', '商户APP_SECRET')->value(Arr::get($appSettings?->value, 'merchant_app_secret', ''));
$this->text('merchant_master_secret', '商户APP_MASTER_SECRET')->value(Arr::get($appSettings?->value, 'merchant_master_secret', ''));
}
}