blog-app/views/layout/header.blade.php
2021-11-13 14:19:55 +08:00

31 lines
1.1 KiB
PHP

<div class="header">
<div class="container">
@section('header')
<h4><a href="/" class="title text-dark">Blog App</a></h4>
@show
@if(isset($_SESSION['is_auth']))
<form method="POST" action="/user/logout" class="float-right">
<input type="hidden" name="_token" value="{{ $_SESSION['_token'] }}">
<button type="submit" class="btn btn-dark">Logout</button>
</form>
<div class="float-right">
<a href="/post/create" class="post-create btn btn-success">New Post</a>
</div>
@else
@if(! preg_match('/\/register$/', $_SERVER['REQUEST_URI']))
<div class="float-right">
<a href="/user/register" class="register btn btn-info">Register</a>
</div>
@endif
@if(! preg_match('/\/login$/', $_SERVER['REQUEST_URI']))
<div class="float-right">
<a href="/user/login" class="login btn btn-light">Login</a>
</div>
@endif
@endif
<div class="float-right">
<input type="text" placeholder="Search title ..." id="search" class="search form-control" value="{{ isset($keyword) ? urldecode($keyword) : '' }}">
</div>
</div>
</div>