laravel-learn-bbs/resources/views/layouts/_header.blade.php

106 lines
5.3 KiB
PHP
Raw Normal View History

2017-12-30 15:45:21 +00:00
<nav class="navbar navbar-default navbar-static-top">
<div class="container">
<div class="navbar-header">
<!-- Collapsed Hamburger -->
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
data-target="#app-navbar-collapse">
<span class="sr-only">Toggle Navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<!-- Branding Image -->
<a class="navbar-brand" href="{{ url('/') }}">
LaraBBS
</a>
</div>
<div class="collapse navbar-collapse" id="app-navbar-collapse">
<!-- Left Side Of Navbar -->
<ul class="nav navbar-nav">
2018-01-01 06:51:46 +00:00
<li class="{{ active_class(if_route('topics.index')) }}"><a href="{{ route('topics.index') }}">话题</a>
</li>
<li class="{{ active_class((if_route('categories.show') && if_route_param('category', 1))) }}"><a
href="{{ route('categories.show', 1) }}">分享</a></li>
<li class="{{ active_class((if_route('categories.show') && if_route_param('category', 2))) }}"><a
href="{{ route('categories.show', 2) }}">教程</a></li>
<li class="{{ active_class((if_route('categories.show') && if_route_param('category', 3))) }}"><a
href="{{ route('categories.show', 3) }}">问答</a></li>
<li class="{{ active_class((if_route('categories.show') && if_route_param('category', 4))) }}"><a
href="{{ route('categories.show', 4) }}">公告</a></li>
2017-12-30 15:45:21 +00:00
</ul>
<!-- Right Side Of Navbar -->
<ul class="nav navbar-nav navbar-right">
<!-- Authentication Links -->
@guest
<li><a href="{{route('login')}}">登录</a></li>
<li><a href="{{route('register')}}">注册</a></li>
@else
2018-01-01 08:32:20 +00:00
<li>
<a href="{{ route('topics.create') }}">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
</a>
</li>
2018-01-27 10:35:56 +00:00
<li>
<a href="{{route('notifications.index')}}" class="notifications-badge" style="margin-top:-2px;">
<span class="badge badge-{{Auth::user()->notification_count>0 ? 'hint':'fade'}}"
title="消息提醒">
{{Auth::user()->notification_count}}
</span>
</a>
</li>
2017-12-30 15:45:21 +00:00
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<span class="user-avatar pull-left" style="margin-right:8px; margin-top:-5px;">
2017-12-30 20:23:09 +00:00
<img src="{{Auth::user()->header}}"
class="img-responsive img-circle" style=" max-height:30px">
2017-12-30 15:45:21 +00:00
</span>
{{ Auth::user()->name }} <span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu">
2018-02-12 15:56:05 +00:00
@can('manage_contents')
<li>
<a href="{{ url(config('administrator.uri')) }}">
<span class="glyphicon glyphicon-dashboard" aria-hidden="true"></span>
管理后台
</a>
</li>
@endcan
2017-12-30 20:23:09 +00:00
<li>
2018-01-01 07:32:35 +00:00
<a href="{{ route('users.show', Auth::id()) }}">
<span class="glyphicon glyphicon-user" aria-hidden="true"></span>
个人中心
</a>
</li>
<li>
<a href="{{ route('users.edit', Auth::id()) }}">
<span class="glyphicon glyphicon-edit" aria-hidden="true"></span>
编辑资料
</a>
2017-12-30 20:23:09 +00:00
</li>
2017-12-30 15:45:21 +00:00
<li>
2018-01-27 10:35:56 +00:00
<form hidden id="logout-form" action="{{route('logout')}}" method="post">
{{csrf_field()}}
</form>
2017-12-30 15:45:21 +00:00
<a href="{{ route('logout') }}"
2018-01-01 07:32:35 +00:00
onclick="event.preventDefault();
document.getElementById('logout-form').submit();">
<span class="glyphicon glyphicon-log-out" aria-hidden="true"></span>
2017-12-30 15:45:21 +00:00
退出登录
</a>
</li>
</ul>
</li>
@endguest
</ul>
</div>
</div>
</nav>