I have tried so many ways but it still won't work. My code is:
@props(['paths'])
<nav>
@foreach($paths as $path)
@php
$isActive = request()->is($path) ? 'active' : 'inactive';
@endphp
<a href="{{ '/' . $path }}" class="{{ $isActive }}">{{ ucfirst($path) }}</a>
@endforeach
</nav>
When I save the file, it auto format the code as above where the line $isActive is not correct.
I've also tried to make it one line like @php $isActive = request()->is($path) ? 'active' : 'inactive'; @endphp, but then the @php lost the syntax highlighting.
Lastly, I've also tried <?php $isActive = request()->is($path) ? 'active' : 'inactive' ?> but then it auto format it as:
<?php $isActive = request()->is($path) ? 'active' : 'inactive' ?> where you can see there is unwanted space before the $isActive (maybe you cannot see here, but there are four spaces).