首页 > 解决方案 > Laravel Doesn't see Routes in Scaffolded Auth login

问题描述

Code:

<div class="col-sm-6 text-right">
    <a href="{{ route('password.request') }}">forgot?</a>
</div>

Error:

Parse error: syntax error, unexpected 'password' (T_STRING), expecting ',' or ')' (View: /path/to/laravel/resources/views/auth/login.blade.php)

When I'm trying to vardump route('password.request') in Tinker it's OK, but Tinker uses PHP 7.1.19 and the web interface 7.1.11 (if that is important).

Stack trace:

  1. {main}() /home/app/path/public/index.php:0
  2. Symfony\Component\Debug\Exception\FatalThrowableError-&gt;() /home/vagrant/www/tonezone/storage/framework/views/e994cd5027a170d4c5b3b3e08ce6dd81af433087.php:39
  3. {main}() /home/app/path/public/index.php:0

Line 39:

<a href="<?php echo e(route('password.request')); ?>"><?php echo app('translator')->getFromJson('forgot?'); ?></a>

标签: phplaravelroutinglaravel-blade

解决方案


If 'password.request' was a string it wouldn't give an error, so I think your quotation marks are inverted.

I would guess that you probably missed one quotation mark in the previous statement in braces. Maybe you were adding translations? It's easy to miss something like it.


推荐阅读