Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

cn1's avatar
Level 3

30 Days to Learn Laravel - Day 10 - Model Factories?

I am working my way through "30 Days to Learn Laravel"

I'm on Day 10 - Model Factories

I am at 12:41 in the video. I am attempting to run:

php artisan tinker

php artisan make:model Employer -m

And I am getting PHP Parse error: Syntax error, T_STRING in vendor\psy\psysh\src\Exception\ParseErrorException.php on line 44

Everything else has worked fine up until this point.

I have already tried the following:

1). Ran: composer clearcache

2). Deleted my vendor packages, and then ran: composer install

3). Ran: composer dump-autoload to regenerate the Composer autoload files.

4). Ran: composer update

Any suggestions?

0 likes
3 replies
LaryAI's avatar
Level 58

The error you're encountering seems to be related to a syntax issue, possibly in your code or configuration files, rather than directly with the commands you're running. Here are a few steps you can take to troubleshoot and resolve the issue:

  1. Check for Syntax Errors:

    • Review your Employer model and any related files for syntax errors. Look for missing semicolons, mismatched brackets, or incorrect PHP tags.
  2. Verify PHP Version:

    • Ensure that your PHP version is compatible with the version of Laravel you are using. You can check your PHP version by running php -v in your terminal.
  3. Check Configuration Files:

    • Look through your config files and routes/web.php for any syntax errors. Sometimes, a small mistake in these files can cause issues.
  4. Run Artisan Commands:

    • Make sure you are running the artisan commands correctly. For example, to create a model with a migration, the command should be:
      php artisan make:model Employer -m
      
  5. Check for Corrupted Files:

    • Sometimes files can become corrupted. Try opening the file mentioned in the error (vendor\psy\psysh\src\Exception\ParseErrorException.php) and see if there are any visible issues.
  6. Reinstall PsySH:

    • Since the error is related to PsySH, try reinstalling it:
      composer remove psy/psysh
      composer require psy/psysh
      
  7. Check for Custom Tinker Configuration:

    • If you have any custom Tinker configuration, ensure it's correctly set up. Check config/tinker.php if it exists.
  8. Clear Cache:

    • Clear any cached configurations or views:
      php artisan config:cache
      php artisan view:clear
      php artisan cache:clear
      

If none of these steps resolve the issue, consider providing more context or error logs to help further diagnose the problem.

Tray2's avatar
Tray2
Best Answer
Level 73

You can not run php artisan commands inside tinker that way, you need to be at the command prompt in your terminal, not in the tinker psy shell.

So don't run php artisan tinker and if you have, make sure to quit it, or open another terminal window

1 like
jlrdw's avatar

Was he in php artisan tinker at that moment.

@tray2 you answered while I was reviewing the video. 😁

Please or to participate in this conversation.