62 lines
2.8 KiB
PHP
62 lines
2.8 KiB
PHP
<?php
|
|
|
|
namespace App\Admin\Forms\Settings;
|
|
|
|
use App\Models\ArticleCategory;
|
|
use App\Models\Setting;
|
|
use Dcat\Admin\Widgets\Form;
|
|
|
|
class App extends Form
|
|
{
|
|
/**
|
|
* Handle the form request.
|
|
*
|
|
* @param array $input
|
|
*
|
|
* @return mixed
|
|
*/
|
|
public function handle(array $input)
|
|
{
|
|
Setting::where('key', 'app')->updateOrCreate([
|
|
'key' => 'app',
|
|
], ['value' => $input]);
|
|
|
|
return $this
|
|
->response()
|
|
->success('配置更新成功!')
|
|
->refresh();
|
|
}
|
|
|
|
/**
|
|
* Build a form here.
|
|
*/
|
|
public function form()
|
|
{
|
|
$appSettings = Setting::where('key', 'app')->first();
|
|
|
|
$this->text('app_name', 'APP名称')->value($appSettings?->value['app_name']);
|
|
$this->divider();
|
|
$this->text('search_hot_keys', '搜索热词(英文半角逗号隔开)')->value($appSettings?->value['search_hot_keys']);
|
|
$this->divider();
|
|
$this->number('order_payment_expires_at', '订单支付过期时间(秒)')->value($appSettings?->value['order_payment_expires_at']);
|
|
$this->number('sale_after_expire_days', '售后过期时间(天)')->value($appSettings?->value['sale_after_expire_days']);
|
|
$this->divider();
|
|
|
|
$this->number('sign_click_points', '签到送积分(分)')->value($appSettings?->value['sign_click_points']);
|
|
$this->number('sign_click_continue', '每连续签到额外奖励(天)')->value($appSettings?->value['sign_click_continue']);
|
|
$this->number('sign_click_continue_points', '每连续签到额外奖励(分)')->value($appSettings?->value['sign_click_continue_points']);
|
|
$this->divider();
|
|
|
|
$this->select('article_help', '帮助文章指定分类')->options(ArticleCategory::whereNull('parent_id')->pluck('name', 'id'))->value($appSettings?->value['article_help']);
|
|
$this->select('article_agreement', '协议文章指定分类')->options(ArticleCategory::whereNull('parent_id')->pluck('name', 'id'))->value($appSettings?->value['article_agreement']);
|
|
$this->select('article_health', '健康文章指定分类')->options(ArticleCategory::whereNull('parent_id')->pluck('name', 'id'))->value($appSettings?->value['article_health']);
|
|
|
|
$this->text('article_about_us', '关于我们文章指定(链接)')->value($appSettings?->value['article_about_us']);
|
|
$this->text('article_user_promotion_agreement', '服务协议文章指定(链接)')->value($appSettings?->value['article_user_promotion_agreement']);
|
|
$this->text('article_user_hide_agreement', '隐私协议文章指定(链接)')->value($appSettings?->value['article_user_hide_agreement']);
|
|
$this->divider();
|
|
|
|
$this->text('invite_uri', '分享邀请地址(链接)')->value($appSettings?->value['article_about_us']);
|
|
}
|
|
}
|