Parse error: syntax error, unexpected end of file


  • | 1515 points

    I am getting error in this line. Please tell me what is wrong
    <?php echo $__env->make('layout.app', array_except(get_defined_vars(), array('__data', '__path')))->render();
    ?>

    The error while submitting the page is "Parse error: syntax error, unexpected end of file (View: C:\laragon\www\todolist\resources\views\todo\home.blade.php)"

    Please help also My home.blade.php has this

    @extends('layout.app')
    @section('body')
    <br>
    <a href="todo/create" class="btn btn-info">Add New</a>
    <div class="col-lg-4 col-lg-offset-4">
    <center><h1>Todo Lists</h1></center>
    <ul class="list-group">
    @foreach($todos as $todo)
    <li class="list-group-item">
    {{$todo->body}}
    </li>
    </ul>
    </div>


  • | 2588 points

    Hola @rb557,

    try to add @endsection at the bottom.


  • | 1515 points

    Hi @rizaldywirawan thanks for the help but I am getting another error..
    Parse error: syntax error, unexpected 'layout' (T_STRING), expecting ',' or ')'
    (View: C:\laragon\www\todolist\resources\views\todo\create.blade.php)

    The code is in create.blade.php

    @extends('layout.app')
    @section('body')
    <br>
    <a href="/todo" class="btn btn-info">Back</a>
    <!-- for margin-->
    <div class="col-lg-4 col-lg-offset-4">
    <h1>Create New Item</h1>
    <form class="form-horizontal" action="/todo/@yield('editForm')" method="post">
    {{csrf_field()}}
    @section('formMethod)
    @show
    <fieldset>
    <div class="form-group">
    <div class="col-lg-10">
    <input type="text" name="title" class="form-control" placeholder="Title">
    <br>
    </div>

                    <div class="col-lg-10">
                        <textarea class="form-control" placeholder="Body" name="body" rows="5" id="textArea">
                        @yield('edit')</textarea>
                        <br>
                        <button type="submit" class="btn btn-success">Submit</button>
                    </div>
                </div>
            </fieldset>
        </form>
        @if(count($errors)>0)
            <div class="alert alert-danger">
                @foreach($errors->all() as $error)
                    {{$error}}
                @endforeach
            </div>
        @endif
    </div>
    @endsection

  • | 1515 points

    create.blade.php:

    @extends('layout.app')
    @section('body')
    <br>
    <a href="/todo" class="btn btn-info">Back</a>
    <!-- for margin-->
    <div class="col-lg-4 col-lg-offset-4">
    <h1>Create New Item</h1>
    <form class="form-horizontal" action="/todo/@yield('editForm')" method="post">
    {{csrf_field()}}
    @section('formMethod)
    @show
    <fieldset>
    <div class="form-group">
    <div class="col-lg-10">
    <input type="text" name="title" class="form-control" placeholder="Title">
    <br>
    </div>
    <div class="col-lg-10">
    <textarea class="form-control" placeholder="Body" name="body" rows="5" id="textArea">
    @yield('edit')</textarea>
    <br>
    <button type="submit" class="btn btn-success">Submit</button>
    </div>
    </div>
    </fieldset>
    </form>
    @if(count($errors)>0)
    <div class="alert alert-danger">
    @foreach($errors->all() as $error)
    {{$error}}
    @endforeach
    </div>
    @endif
    </div>
    @endsection


  • | 2588 points

    Hi @rb557,

    Can you post your resource folder structure and your app.blade.php?


  • | 587 points

    you are missing an @endforech

    @foreach($todos as $todo)
    <li class="list-group-item">
    {{$todo->body}}
    </li>
    @endforeach


  • | 1515 points

    Ya thank you everyone it helped..


Log in to reply
 

Looks like your connection to Laragon was lost, please wait while we try to reconnect.