语法错误,意外'否则' (T_ELSE)在laravel

时间:2018-06-18 13:56:58

标签: php mysql laravel syntax project

我是编程和laravel的初学者,我对我的代码/项目有一些问题。 我想要一个条件,我的主网页菜单只能由auth用户访问,但我在代码中的make条件时出错。 请帮我解决这个问题

* ps sory for bad english

这里的观点

<!DOCTYPE html>
<html lang="en">
<head>
  <title>DOKO MOTOR</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <link rel="stylesheet" href="{{url('/')}}/css/lwd.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>

<div id="top-header" style="background:#FFF;height: 100px;"s>
<div id="header" class="hidden-sm hidden-xs">
  <img src="{{url('/')}}/img/logo.png" height="90px" style="position: absolute;">
  <div class="bendera"></div>
              <div class="hotline pull-right">
                  <div class="left"><i class="glyphicon glyphicon-earphone" style="
    font-size: 50px; color:red;
"></i></div>
                    <div class="right">
                    <div class="r-top">hotline :</div>
                        <div class="r-bot">0896 5200 6229</div>
                    </div>
                    <div class="break"></div>
                </div><!-- /.hotline -->
                <div class="top-wel pull-right">Selamat datang di website kami, Jumat, 11 Mei 2018 </div>
</div><!-- /#header -->

</div>

<nav class="navbar navbar-default">
  <div class="container-fluid">
    <div class="navbar-header">
      <a class="navbar-brand" href="{{ url("") }}">DOKO MOTOR</a>
    </div>
    <ul class="nav navbar-nav">
      <!-- @if(Auth::user()) -->
      @if(Auth::user())
      <li class="{{ request()->is('book') ? 'active' : '' }}"><a href="{{ url("book") }}"><span class="glyphicon glyphicon-wrench"></span> Book Service</a></li>
      <!-- @endif -->
      <li class="{{ request()->is('services') ? 'active' : '' }}"><a href="{{ url("services") }}"><span class="glyphicon glyphicon-hourglass"></span> Antrian Service</a></li>
      <li class="{{ request()->is('contact') ? 'active' : '' }}"><a href="{{ url("contact") }}"><span class="glyphicon glyphicon-user"></span> Kontak</a></li>
      <li class="{{ request()->is('tentang') ? 'active' : '' }}"><a href="{{ url("tentang") }}"><span class="glyphicon glyphicon-earphone"></span> Tentang</a></li>


    </ul>
    <ul class="nav navbar-nav navbar-right">
      <!-- @if(Auth::user()) --> 
      <li><a href="{{URL::to('/logout')}}">
      <span style="color: blue"> {{ ucwords(Auth::user()->name) }}</span> <span class="glyphicon glyphicon-log-in"></span> Logout</a></li>
      <!-- @else -->
      @else

      <li><a href="{{URL::to('/register')}}"><span class="glyphicon glyphicon-user"></span> Daftar</a></li>
      <li><a href="{{URL::to('/signin')}}"><span class="glyphicon glyphicon-log-in"></span> Login</a></li>
      <!-- @endif -->
      @endif
    </ul>
  </div>
</nav>

<div class="container">
  @yield('content')
</div>

<div id="footer">


        <div class="row">
          <div class="col-md-12">
              <div class="copy">Copyright © 2018 -  All rights reserved.</div>
            </div>
        </div><!-- /.row -->
</div>
</body>
</html>

这里是路线

Route::get('/signin', function() {
    return view('login');
});

Route::get('/register/{date?}', function($date = null) {
    return view('register',['date',$date]);
});

Route::post('/register_action/{date?}','RegisterController@store');

Route::post('/login_check','RegisterController@login');

Route::get('logout', function() {
    Auth::logout();

    return Redirect::to('');
})->middleware("auth");

Route::get('/', function(){
    if( auth()->check() ){
        return Redirect::to('/');
    }else{
        return Redirect::to('/auth');   
    }
});

Route::get('/', 'HomeController@index');

Route::get('/contact','ContactController@index');

Route::get('/tentang','TentangController@index');

Route::get('/book/{date?}', 'ServisController@book');

Route::get('/services/{add?}', 'ServisController@services');

Route::post('/submit_book', 'ServisController@submit_book'); 

Route::post('/update_service', 'ServisController@update_service'); 

Route::post('/delete_service', 'ServisController@delete_service');

error message

我会感激任何可以帮助我的事情

请问

1 个答案:

答案 0 :(得分:1)

尝试更改构建html的方式:

public ReporterBuilder SetEmail(Action<EmailConfig> config)
{
    if (config == null)
        throw new ArgumentNullException();

    var cfg = new EmailConfig();

    // optionally populate the cfg with 
    // default configuration before calling method

    config(cfg);

    // cfg contains your configuration 
    // and is full of that thing called 'love'

    return this;
}

在if语句之后编写HTML的方式必须有意义,可视化此尝试删除情境将创建的代码,因此如果用户不在那里删除该代码并查看剩下的内容,如果您的HTML没有意义,浏览器将无法以您希望的方式呈现它