skip to Main Content
  • Laravel Version: 5.5.
  • PHP Version: 7.0.0

exception: "SymfonyComponentDebugExceptionFatalThrowableError"

file: "/app/Http/Controllers/New/Folder/FlightController.php"

line: 3

message: "Parse error: syntax error, unexpected ‘New’ (T_NEW), expecting identifier (T_STRING)"

Getting parse/syntax error for using New as the Folder name

app/Http/Controllers/New/Folder/FlightController.php

<?php

namespace appHttpControllersNewFolder; // This is error line as per complete Error message

use IlluminateHttpRequest;
use AppHttpControllersController;
use AppModelsFlight;

class FlightController extends Controller
{

2

Answers


  1.     $tObject = new Flight;
        $flight = Flight::where('email', $request->email) ?? $tObject;
    
    Login or Signup to reply.
  2. Don’t use reserved words for variable/file/directory name. Programming 101.

    Beside that you can have New as directory name if PHP8 is being used.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search