mardi 29 août 2017

Laravel,PHP - Error when returning my blade view

I keep getting an error that says that I got an error "Parse error: syntax error, unexpected end of file, expecting elseif (T_ELSEIF) or else (T_ELSE) or endif (T_ENDIF) " in my master blade view.It says that the error is in "c8b1f4540e0eacfb9a43e3fc107c6a88db708eac.php (line 150)" when I only 148 lines in my code.

My routes:

Route::get('search',array('as'=>'search','uses'=>'AutoCompleteController@search'));
Route::get('autocomplete',array('as'=>'autocomplete','uses'=>'AutoCompleteController@autocomplete')); 

My Controller:

<?php

namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Product;
class AutoCompleteController extends MainController {

      public function search()
    {
        return view('master');
    }

     public function autocomplete(Request $request)
     {

if( !empty(request('query'))){

        $data = Product::select("title")
        ->where("title","LIKE","%{$request->input('query')}%") 


->get(); 
         dd('justrandom');
     $dataJson =$data->toJson();
        return view('master', compact('dataJson'));
}else{ 

  return view ('master', ['dataJson' => false]);

}

    }
} 

My master blade:

<head>
    <meta charset="UTF-8">
    <title>@if (!empty($title) )
          
        @else
        MySite
        @endif</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="http://ift.tt/2apRjw3" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    <link rel="stylesheet" href="http://ift.tt/2aHU2x3" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">  
    <link href="" rel="stylesheet" type="text/css"/>
    <link href="" rel="stylesheet"/>    
    <script>var BASE_URL = "/";</script>  


</head>

<header>
    <!-- NAVBAR
================================================== -->
    <body>
        <div class="navbar-wrapper">
            <div class="container-fluid">

                <nav class="navbar navbar-inverse navbar-static-top">
                    <div class="container-fluid">
                        <div class="navbar-header">
                            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
                                <span class="sr-only">Toggle navigation</span>
                                <span class="icon-bar"></span>
                                <span class="icon-bar"></span>
                                <span class="icon-bar"></span>
                            </button>
                            <a class="navbar-brand" href="">MySite</a>

                        </div>
                        <div id="navbar" class="navbar-collapse collapse" >

                            <ul class="nav navbar-nav">

                                @if( !empty($menu))
                                @foreach($menu as $item)
                                <li><a href=""></a></li>
                                @endforeach
                                @endif

                                <li><a href="">Shop</a></li>
                                <li>
                                    <a href="">
                                        <img width="20" src="">  
                                        <div id="total-cart">
                                            @if(! Cart::isEmpty())
                                            
                                            @endif
                                        </div>

                                    </a>
                                </li>
                            </ul>  

                            <ul class="nav navbar-nav navbar-right">
                                @if(Session::has('user_id'))
                                <li><a href=""></a></li>  
                                @if( Session::has('is_admin'))
                                <li><a href="">CMS DASHBOARD</a></li>  
                                @endif
                                <li><a href="">Logout</a></li>
                                @else
                                <li><a href="">Sign In</a></li>
                                <li><a href="">Sign Up</a></li>  

                                @endif
                            </ul>
                            <div class="row">
                            <div class="container">
                                <form method="GET" action="" class="navbar-form navbar-right">

                        <div class="input-group">
                            <input type="text" name="find" class="typeahead form-control" aria-label="Search here..." placeholder="Search here..." autocomplete="off" value="">
                            <div class="input-group-btn">
                                <button type="submit" class="btn btn-default" style="height: 34px; width: 40px" ><i class="glyphicon glyphicon-search"></i></button>
                            </div>
                        </div>
                    </form>

                        </div>
                    </div>
                </nav>

            </div>
        </div>




</header>  <br><br><br><br>


 @if(!empty($dataJson))
    @foreach(json_decode($dataJson, true) as $value)
          
    @endforeach
$endif

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

<main>  
    <div class="container">

        @include ('inc.sm')
        @include ('inc.errors')


        @yield('content')  

    </div>

</main>  
<br><br><br>
<footer>  
    <div class="container">  
        <hr>
        <div class="row">
            <div class="col-md-12" >
                <p class="text-center" style="font-size: 18px;" >MySite &copy;  </p>
            </div>
        </div>
    </div>

</footer>    



<script src="http://ift.tt/2n9t8Vj"></script>
<script src="http://ift.tt/2aHTozy" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="http://ift.tt/2scr4kY"></script>
<script src="" type="text/javascript"></script>  
<script type="text/javascript">
    var path = "";
    $('input.typeahead').typeahead({
        source:  function (query, process) {
        return $.get(path, { query: query }, function (data) {
                return process(data);
            });
        }
    });
</script>



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire