Use default background image when option leaved empty

This commit is contained in:
printempw 2017-08-05 14:35:28 +08:00
parent 96633db340
commit bc7679fd0d
4 changed files with 5 additions and 4 deletions

View File

@ -9,7 +9,8 @@ class HomeController extends Controller
{ {
public function index(UserRepository $users, Request $request) public function index(UserRepository $users, Request $request)
{ {
return view('index')->with('user', $users->getCurrentUser()); return view('index')->with('user', $users->getCurrentUser())
->with('home_pic_url', option('home_pic_url') ?: config('options.home_pic_url'));
} }
} }

View File

@ -5,7 +5,7 @@ homepage:
home_pic_url: home_pic_url:
title: Picture URL at Homepage title: Picture URL at Homepage
hint: Path relative to homepage or full URL. hint: Path relative to homepage or full URL, leave empty to use default image
favicon_url: favicon_url:
title: Website Icon title: Website Icon
hint: Path relative to resources/assets/ or full URL. hint: Path relative to resources/assets/ or full URL.

View File

@ -5,7 +5,7 @@ homepage:
home_pic_url: home_pic_url:
title: 首页图片地址 title: 首页图片地址
hint: 相对于首页的路径或者完整的 URL hint: 相对于首页的路径或者完整的 URL,留空以使用默认背景
favicon_url: favicon_url:
title: 网站图标 title: 网站图标
hint: 相对 resources/assets/ 的路径或者完整的 URL hint: 相对 resources/assets/ 的路径或者完整的 URL

View File

@ -13,7 +13,7 @@
<body class="hold-transition {{ option('color_scheme') }} layout-top-nav"> <body class="hold-transition {{ option('color_scheme') }} layout-top-nav">
<div class="wrapper" style="background-image: url('{{ option('home_pic_url') }}');"> <div class="wrapper" style="background-image: url('{{ $home_pic_url }}');">
<!-- Navigation --> <!-- Navigation -->
<header class="main-header transparent"> <header class="main-header transparent">
<nav class="navbar navbar-fixed-top"> <nav class="navbar navbar-fixed-top">