I am gonna bump this question because it's driving me insane. I changed around some middleware because i am working with webhooks from a payment solution . Maybe it is an csrf issue? You can test the problem here: http://noblesse-baby.be/producten/my-7-kussen . try to add a item to the shopping cart and try to delete it from the top right corner. Sometimes it will work perfectly and sometimes you have to click multiple times. Here are some snippets of code that might be usefull :
Kernel.php where i switched the csrf from global middleware to this:
protected $routeMiddleware = [
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'role' => \Zizaco\Entrust\Middleware\EntrustRole::class,
'permission' => \Zizaco\Entrust\Middleware\EntrustPermission::class,
'ability' => \Zizaco\Entrust\Middleware\EntrustAbility::class,
'checkForRole' => \App\Http\Middleware\checkForRole::class,
'csrf' => \App\Http\Middleware\VerifyCsrfToken::class,
];
I surrounded the routes with following middleware:
Route::group(['middleware' => ['web', 'csrf']], function () {
}
On some of my controllers inside these middleware groups i changed the constructor to exclude some middleware
public function __construct()
{
$this->middleware('auth', ['except' => [
'store','destroy'
]]);
}
on some of my controller methods that are affected i have used: Return back() , maybe that causes an issue?