Laravel: getting blade components syntax error, unexpected 'endif' (T_ENDIF), expecting end of file

Issue

I am learning laravel on Laracast however I am having some issues

I have this code on file components/layout.blade.php

<!DOCTYPE html>
<head>
    <title>Host Cloud Template - Services</title>
</head>

<body>
    {{$content}}
</body>

And this on main.blade.php which is the page the view redirects to

<x-layout content = "Hello There">


</x-layout>

For some reason Laravel is returning this error:

syntax error, unexpected 'endif' (T_ENDIF), expecting end of file (View: C:\laragon\www\Conferencias\resources\views\template\main.blade.php)

Solution

I found what was causing the problem, I had a space between content and ="Hello There" by removing it and leaving it like content="Hello There" solves the problem.

Answered By – BIDS Salvaterra

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published