syntax error, unexpected token ";", expecting ")"

I’m trying to display a list of users in a table and provide a link for each user to view their details on a separate page. However, I get a parse error

Here are my codes

User list page:

<table class="user-list-table table">
        <thead class="table-light">
            <th>Phone Number</th>
          @foreach($users as $item)
            <td>{{ $loop->iteration }}</td>
              href="{{ route('user-view', ['id' => $item->id] }}">
              {{ $item->name }}
            <td>{{ $item->email }}</td>
            <td>{{ $item->password }}</td>
            <td>{{ $item->phone_number }}</td>
            <td>{{ $item->is_admin }}</td>


The UserController:

public function show($id)
        $user = User::find($id);
        return view('main.user.user-view-account')->with('user', $user);

The route to main.user.user-view-account:

Route::get('user-view/{id}', [UserController::class, 'show'])->name('user-view');

I’m trying to route user to user/id/view, can anybody see what is causing the error please

>Solution :

inside your Anchor tag you need to close your route

  href="{{ route('user-view', ['id' => $item->id]) }}"
  {{ $item->name }}

Leave a Reply