2

I am getting error in this line

<?php echo $__env->make('layout.app', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>

The error while submitting the page is as below:

"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>
Aftab H.
  • 1,517
  • 4
  • 13
  • 25

3 Answers3

3

You need to add @endsection to the end of the blade file:

@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>
@endsection
Alexey Mezenin
  • 158,981
  • 26
  • 290
  • 279
1

There should be an "@endforeach" after the closing li tag:

@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>
            @endforeach
        </ul>
    </div>
@endsection
Rouhollah Mazarei
  • 3,969
  • 1
  • 14
  • 20
0

Sometimes when you use <?php your code ?> or <? your code ?> instead of @php your code @endphp you can get the same error

in general, this will happen if you forget to close @enif @endforeach @endsection etc ...

Zouhair Kasmi
  • 614
  • 2
  • 6
  • 13