2015-03-13 56 views
0

我想在我的劍道UI電網執行更新,但我不斷收到:Laravel 5劍道UI網更新令牌不匹配

TokenMismatchException in VerifyCsrfToken.php line 46 

我的更新代碼到目前爲止很簡單:

public function update(Request $request) 
{ 
    $data = $request->all(); 
} 

我該如何解決這個問題?


POST請求是:

id:1 
created_by:1 
first_name:Tom 
account_name: 
net:124.05 
created_at:Sun Mar 08 2015 14:43:08 GMT+0000 (GMT Standard Time) 
symbol:£ 
category_id:2 
category_name:Drink 
type_id:1 
type_name:Cash 

請求頭:

Accept:application/json, text/javascript, */*; q=0.01 
Accept-Encoding:gzip, deflate 
Accept-Language:en-US,en;q=0.8 
Cache-Control:no-cache 
Content-Length:201 
Content-Type:application/x-www-form-urlencoded; charset=UTF-8 
Cookie:XSRF-TOKEN=eyJpdiI6IjU2cHo3ZVd6KzFWaUlFVFRDV1lVUHc9PSIsInZhbHVlIjoib0pBU00wclJmVU9ROVwvTkxIeDVcL1QwY3EwVlg4YVowemVXQWpDMjVjZVMybEVPK2tjeFwvNlA4STExOWN4WHg3WHdzemN6UlEwTkg1d0haWElGOVoxNnc9PSIsIm1hYyI6ImI0YmI5MzM2YTdlZjlmYjRhNTAyMDU2NWI2NTU5YmFmNWUzODIzZDAxYWVmNTUzZDkyY2Q1MWE1ZWRjZWUzZDAifQ%3D%3D; laravel_session=eyJpdiI6Ik9zaFJ3S2JiM2lvcnJBN01UT29hM2c9PSIsInZhbHVlIjoiblwvbGRtcFRmakdhdzRYV1dUdnZWSzNFb3pjSUdrendrbk5IZVFPWGtDZGF0dmNnMGNDUGxlRzVvQ0cxVWRFeWI0djhzOEY1ZWk4M0Q0WHg3dE1GMENBPT0iLCJtYWMiOiI0YWVmNzFjOTQ5NWU5ODc4MDA0NTVhMmU0M2E3OWZkNGI3NTA1NWE2OWU2YjczYjA3M2NkNTcxMTBhZWZmNzYxIn0%3D 
Host:mbms.com 
Origin:http://mbms.com 
Pragma:no-cache 
Proxy-Connection:keep-alive 
Referer:http://mbms.com/core/finance/transactions 
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36 
X-Requested-With:XMLHttpRequest 

回答

0

我似乎通過執行以下操作有固定的:

<div id="incomeGrid" data-csrf="{!! csrf_token()!!}"></div> 

在我DS:

... 
update: { 
      url: '/core/income-grid/update', 
      dataType: 'json', 
      type: 'post', 
      data: function(data){ 
       data._token = $('#incomeGrid').data('csrf'); 
       return data; 
      } 
     }, 
... 
0

<input type="hidden" name="_token" value="<?php echo csrf_token(); ?>" 

形式接近

之前在表單中包含此