Skip to content

Commit

Permalink
feat:Luna站点模板代码,后台配置增加一个图片logo选项
Browse files Browse the repository at this point in the history
  • Loading branch information
Julyssn committed Oct 20, 2020
1 parent 9433438 commit d2f3b8a
Show file tree
Hide file tree
Showing 21 changed files with 2,126 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/Admin/Forms/Setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ class Setting extends Form
public function handle(Request $request)
{
$data = $request->all();
$webset = Webset::where('id', 1)->update($data);
if (isset($request->img_logo) && $request->img_logo->isValid()) {
$path = $request->img_logo->store('images','admin');
$data['img_logo'] = 'uploads/' . $path;
}
Webset::where('id', 1)->update($data);
admin_success('成功', '保存网站设置成功');
return redirect(config('admin.route.prefix') . '/setting');
}
Expand All @@ -36,6 +40,7 @@ public function handle(Request $request)
public function form()
{
$this->text('title', __('Sys title'))->rules('required');
$this->image('img_logo', __('Sys img logo'))->help('网站logo');
$this->text('text_logo', __('Sys text logo'))->rules('required');
$this->text('keywords', __('Sys keywords'))->rules('required');
$this->textarea('description', __('Sys description'))->rules('required');
Expand All @@ -58,6 +63,7 @@ public function form()
public function data()
{
$webset = Webset::where('id', 1)->first();
$webset->img_logo = url($webset->img_logo);
return $webset->toArray();
}

Expand Down
7 changes: 7 additions & 0 deletions database/sql/update.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/*
网站图片logo
*/
ALTER TABLE `webset` ADD COLUMN `img_logo` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL AFTER `title`;
UPDATE `webset` SET `img_logo` = 'uploads/images/default.jpg' WHERE `id` = 1;


/*
1.7.2版本更新sql
*/
Expand Down
2 changes: 2 additions & 0 deletions public/assets/luna/js/jquery-3.4.1.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit d2f3b8a

Please sign in to comment.