Laravel model can't be named 'Match' [duplicate]
I want to create a model in Laravel named 'Match'. When I try to do this, I get an error: syntax error, unexpected token "match", expecting identifier
. When I add a character (for example: 'Matcha'), the error goes away.
I am using this code in composer.json
:
"require": {
"php": "^7.3|^8.0",
"beyondcode/laravel-websockets": "^1.12",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^8.75",
"laravel/sanctum": "^2.11",
"laravel/tinker": "^2.5",
"laravel/ui": "^3.4"
},
"require-dev": {
"facade/ignition": "^2.5",
"fakerphp/faker": "^1.9.1",
"laravel/sail": "^1.0.1",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^5.10",
"phpunit/phpunit": "^9.5.10"
},
I have tried to solve the problem, but I couldn't find any solutions on the internet.
Is there a way I can solve this error?
You are using PHP 8 and match is a reserved keyword in PHP 8.
Refer reserved keywords.