这是我的桌子:
id remaining_amount additional_amount
1 200 0
2 100 -100
3 300 100
4 200 -50
Run Code Online (Sandbox Code Playgroud)
我正在尝试获取总和为剩余金额+额外金额> 0 的行。
$result = $this->model->where('remaining_amount' + 'total' > 0)->get();
Run Code Online (Sandbox Code Playgroud)
它不起作用。然后我尝试这样:
$result = DB::table('cash')->select(DB::raw('remaining_amount+additional_amount AS total'))
->where('total','>',0)
->get();
Run Code Online (Sandbox Code Playgroud)
它也不起作用。
请告诉我解决这个问题的方法。
我使用Dropzone.js上传图片.当我想删除图像时,我向图像控制器发送了Ajax删除请求.
myDropzone.on("removedfile", function(file) {
console.log(file.name);
console.log(uploadedImages[file.name]);
var csrf = $('input[name=_token]').val();
// var csrf = $('meta[name="_token"]').attr('content');
console.log(csrf);
var request = $.ajax({
url: "/cms/image/"+uploadedImages[file.name],
headers: {
'X-CSRF-Token': csrf ,
"Accept": "application/json"
},
type: "DELETE",
data: { "id": uploadedImages[file.name] },
error: function(jqXHR, textStatus, errorThrown) {
// alert('HTTP Error: '+errorThrown+' | Error Message: '+textStatus);
console.log(errorThrown);
},
Run Code Online (Sandbox Code Playgroud)
该方法在我的旧项目中成功发送到带有删除请求的Controller.
但我合并到其他项目,我得到了错误.
VerifyCsrfToken.php中的TokenMismatchException
我不明白为什么会发生这种异常.请解释一下我的情况.感谢并尊重所有极客.