forked from summerblue/larabbs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
953366d
commit 670ea35
Showing
5 changed files
with
95 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,9 @@ | |
'topics', | ||
'replies', | ||
], | ||
'站点管理' => [ | ||
'settings.site', | ||
], | ||
], | ||
|
||
/* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
<?php | ||
|
||
use Illuminate\Support\Facades\Auth; | ||
use Illuminate\Support\Facades\Artisan; | ||
|
||
return [ | ||
'title' => '站点设置', | ||
|
||
// 访问权限判断 | ||
'permission'=> function() | ||
{ | ||
// 只允许站长管理站点配置 | ||
return Auth::user()->hasRole('Founder'); | ||
}, | ||
|
||
// 站点配置的表单 | ||
'edit_fields' => [ | ||
'site_name' => [ | ||
// 表单标题 | ||
'title' => '站点名称', | ||
|
||
// 表单条目类型 | ||
'type' => 'text', | ||
|
||
// 字数限制 | ||
'limit' => 50, | ||
], | ||
'contact_email' => [ | ||
'title' => '联系人邮箱', | ||
'type' => 'text', | ||
'limit' => 50, | ||
], | ||
'seo_description' => [ | ||
'title' => 'SEO - Description', | ||
'type' => 'textarea', | ||
'limit' => 250, | ||
], | ||
'seo_keyword' => [ | ||
'title' => 'SEO - Keywords', | ||
'type' => 'textarea', | ||
'limit' => 250, | ||
], | ||
], | ||
|
||
// 表单验证规则 | ||
'rules' => [ | ||
'site_name' => 'required|max:50', | ||
'contact_email' => 'email', | ||
], | ||
|
||
'messages' => [ | ||
'site_name.required' => '请填写站点名称。', | ||
'contact_email.email' => '请填写正确的联系人邮箱格式。', | ||
], | ||
|
||
// 数据即将保存时触发的钩子,可以对用户提交的数据做修改 | ||
'before_save' => function(&$data) | ||
{ | ||
// 为网站名称加上后缀,加上判断是为了防止多次添加 | ||
if (strpos($data['site_name'], 'Powered by LaraBBS') === false) { | ||
$data['site_name'] .= ' - Powered by LaraBBS'; | ||
} | ||
}, | ||
|
||
// 你可以自定义多个动作,每一个动作为设置页面底部的『其他操作』区块 | ||
'actions' => [ | ||
|
||
// 清空缓存 | ||
'clear_cache' => [ | ||
'title' => '更新系统缓存', | ||
|
||
// 不同状态时页面的提醒 | ||
'messages' => [ | ||
'active' => '正在清空缓存...', | ||
'success' => '缓存已清空!', | ||
'error' => '清空缓存时出错!', | ||
], | ||
|
||
// 动作执行代码,注意你可以通过修改 $data 参数更改配置信息 | ||
'action' => function(&$data) | ||
{ | ||
Artisan::call('cache:clear'); | ||
return true; | ||
} | ||
], | ||
], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,6 @@ | |
由 <a href="http://weibo.com/u/1837553744?is_hot=1" target="_blank">Summer</a> 设计和编码 <span style="color: #e27575;font-size: 14px;">❤</span> | ||
</p> | ||
|
||
<p class="float-end"><a href="mailto:[email protected]">联系我们</a></p> | ||
<p class="float-end"><a href="mailto:{{ setting('contact_email') }}">联系我们</a></p> | ||
</div> | ||
</footer> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"site_name":"\u7ad9\u70b9\u540d\u79f0: - Powered by LaraBBS","contact_email":"\u8054\u7cfb\u4eba\u90ae\u7bb1@learnku.com","seo_description":"SEO - Description:","seo_keyword":"SEO - Keywords:"} |