My blade directives aren't working, as you see I don't have the PHP code in PHP tags, because its a blade directive and I'm not supposed to add those. But for some reason the PHP code keeps showing in the browser and not executing, why is this happening?
Also, in my text editor, the PHP code color is white, which I can tell is a problem. I think that the code is outdated, and if so, how can I get it up to date?
I'm using Laravel 5.5, and my PHP version is 7.0.
@foreach($posts as $post)
<div class="post" data-postid="{{ $post->id }}">
<a href="#"><h3>{{ $post->title }}</h3></a>
<h6>Posted on {{ $post->created_at }} by {{ $post->user->name }}</h6>
<p>{{ $post->body }}</p>
<div class="interaction">
<a href="#">Likes</a>
<a href="#">Dislikes</a>
<hr>
</div>
</div>
@endforeach
Your file must have .blade extension in it, otherwise @, {{ }} etc would not be recognize, and would not work. Check if your files are named correctly like example.blade.php