phplaravel-6

Laravel 6: syntax error, unexpected 'js' (T_STRING), expecting ')'


I am adding a JavaScript file in my Laravel 6 application using the asset helper: <script src="{{ asset('js/todolist.js') }}"></script> here is the error I get:

Facade\Ignition\Exceptions\ViewException

syntax error, unexpected 'js' (T_STRING), expecting ')' (View: C:\Dev\Laravel\teacher\resources\views\layouts\base.blade.php)

The JS file is under my public/js folder.

Here's my blade file content:

<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- CSRF Token -->
    <meta name="csrf-token" content="{{ csrf_token() }}">
    <title>
        @section('title')
            {{ config('app.name', 'Laravel') }}
        @endsection
        @yield('title')
    </title>
    <!-- plugins:css -->
    <link rel="stylesheet" href="{{ asset('vendors/ti-icons/css/themify-icons.css') }}">
    <link rel="stylesheet" href="{{ asset('vendors/css/vendor.bundle.base.css') }}">
    <!-- endinject -->
    <!-- Plugin css for this page -->
@yield('css_top')
<!-- End plugin css for this page -->
    <!-- inject:css -->
    <link rel="stylesheet" href="{{ asset('css/vertical-layout-light/style.css') }}">
    <!-- endinject -->
    <link rel="shortcut icon" href="{{ asset('images/favicon.png') }}"/>
</head>
<body>
<div class="container-scroller">
    <!-- partial:partials/_navbar.html -->
@include('partials._navbar')
<!-- partial -->
    <div class="container-fluid page-body-wrapper">
        <!-- partial:partials/_settings-panel.html -->
    @include('partials._settings-panel')
    <!-- partial -->
        <!-- partial:partials/_sidebar.html -->
    @include('partials._sidebar')
    <!-- partial -->
        <div class="main-panel">
            <div class="content-wrapper">
                @yield('content')
            </div>
            <!-- content-wrapper ends -->
            <!-- partial:partials/_footer.html -->
        @include('partials._footer')
        <!-- partial -->
        </div>
        <!-- main-panel ends -->
    </div>
    <!-- page-body-wrapper ends -->
</div>
<!-- container-scroller -->

<!-- plugins:js -->
<script src="{{ asset('vendors/js/vendor.bundle.base.js') }}"></script>
<!-- endinject -->
<!-- Plugin js for this page -->
<script src="{{ asset('vendors/chart.js/Chart.min.js') }}"></script>
<!-- End plugin js for this page -->
<!-- inject:js -->
<script src="{{ asset('js/off-canvas.js') }}"></script>
<script src="{{ asset('js/hoverable-collapse.js') }}"></script>
<script src="{{ asset('js/template.js') }}"></script>
<script src="{{ asset('js/settings.js }}"></script>
<script src="{{ asset('js/todolist.js') }}"></script>
<!-- endinject -->
<!-- Custom js for this page-->
@section('css_bottom')
    <script src="{{ asset('js/dashboard.js') }}"></script>
@endsection
@yield('css_bottom')
<!-- End custom js for this page-->
</body>
</html>

Please help.

UPDATE: added blade file


Solution

  • There was an error somewhere in my blade file.

    I forgot to put the apostrophe and close the parenthesis:

    HERE: <script src="{{ asset('js/settings.js }}"></script>

    and the error has been reported here:

    <script src="{{ asset('js/todolist.js') }}"></script>

    After making the correction by adding the apostrophe and parenthese, everything works well.