0

I put dd($next) for debug in my middleware like this (VerifyCsrfToken.php):

public function handle($request, Closure $next)
{
    dd($next);
    // Add this:
    if($request->method() == 'POST')
    {
        return $next($request);
    }

    if ($request->method() == 'GET' || $this->tokensMatch($request))
    {
        return $next($request);
    }

    throw new TokenMismatchException;
}

And I deleted it but now ALWAYS in my app shows TRUE, nothing more. I deleted cache, make composer autoload...

EDIT

Full code:

    <?php namespace App\Http\Middleware;

use Closure;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier;

use Exception;

class TokenMismatchException extends Exception {}

class VerifyCsrfToken extends BaseVerifier {

    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */



    /*public function handle($request, Closure $next)
    {
        return parent::handle($request, $next);
    }*/
    public function handle($request, Closure $next)
    {
        // Add this:
        if($request->method() == 'POST')
        {
            return $next($request);
        }

        if ($request->method() == 'GET' || $this->tokensMatch($request))
        {
            return $next($request);
        }

        throw new TokenMismatchException;
    }

}
Marc Garcia
  • 1,388
  • 1
  • 9
  • 21
  • 1
    Well, telling you the truth, I would try to explicitly save the file again. There is always a possibility that it is not saved. Depending on your development infrastructure, it also may be that the file wasn't synchronized to your homestead box. – Artyom Sokolov Aug 08 '16 at 21:31
  • Maybe you have another `dd()` call somewhere else – adrian7 Aug 08 '16 at 22:03
  • Actually I develop on a Windows with Xampp, and it worked ok since this change. I try to put other dd() but it always shows true :S. It's seems like dd() is cached or something else.. I don't know. – Marc Garcia Aug 09 '16 at 07:48
  • Can you share the full file? Do you have `use Closure;`? – Alex Harris Aug 09 '16 at 11:56
  • I added full file, and I already have Clousure – Marc Garcia Aug 12 '16 at 18:04
  • try clearing cache `php artisan cache:clear` `php artisan clear` – nonsensei Nov 16 '16 at 17:34

0 Answers0