Home > Mobile >  Laravel Spatie syntax error, unexpected token "readonly"
Laravel Spatie syntax error, unexpected token "readonly"

Time:01-01

I'm getting this error anyone knows how to fix this?

It's working fine on the local server but when we set up on serverless server it throws this error.

syntax error, unexpected token "readonly" (View: /workspace/resources/views/backend/teams/form.blade.php)

in /workspace/vendor/spatie/laravel-html/src/Elements/Input.php (line 23)

    use Autofocus;    
    use Disabled;    
    use MinMaxLength;    
    use Name;    
    use Placeholder;    
    use Readonly;    
    use Required;    
    use Type;    
    use Value;

use Readonly; is line 23

CodePudding user response:

Shouldn't it be 'readonly' instead of Readonly. Just shooting in the dark here.

Although it may also be related to different PHP versions on your system and server/

CodePudding user response:

The issue was with PHP 8.1 as @Nigel Ren mentioned that readonly is now part of the language. I downgraded the PHP version to 7.4 and it started working.

  • Related