Answer the question
In order to leave comments, you need to log in
How to change error message in Laravel?
Hello.
Error logs contain messages like:
[2015-06-17 12:43:32] local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Class 'App\Http\Middleware\TokenMismatchException' not found' in ..................................../public_html/app/Http/Middleware/VerifyCsrfToken.php:29
Answer the question
In order to leave comments, you need to log in
So why include DEBUG on the market ?
In .env write DEBUG=false .
You can also write your own processing logic in the render method in app/Exceptions/Handler.php
<?php namespace App\Http\Middleware;
use Closure;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier;
class VerifyCsrfToken extends BaseVerifier {
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
protected $except_urls = [
'tarif',
];
public function handle($request, Closure $next)
{
//return parent::handle($request, $next);
$regex = '#' . implode('|', $this->except_urls) . '#';
if ($this->isReading($request) || $this->tokensMatch($request) || preg_match($regex, $request->path()))
{
return $this->addCookieToResponse($request, $next($request));
}
throw new TokenMismatchException;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question