简体   繁体   English

没有模型 [App\\Coin] 的查询结果。 - Laravel - Vuejs

[英]No query results for model [App\Coin]. - Laravel - Vuejs

i got No query results for model [App\\Coin].我没有得到模型 [App\\Coin] 的查询结果。 on my put function.在我的 put 函数上。 I don't know why ?我不知道为什么? This my my vue js code :这是我的 vue js 代码:

var app = new Vue({
el: '#app',
data: {
    cash: {
        codeentry: '',
        description: '',
        cash: '',
    },
    upload: {
        bank: '',
        id: '',
    },
},
methods: {
   let my_data = { upload: this.upload, cash: this.cash.cash }
     axios.put('/updatebank',  my_data)
            .then(response => {
                if (response.data.etat) {
                    this.upload.id = response.data.etat.id
                    this.upload.bank = response.data.etat.bank
                    this.cash.cash = response.data.etat.cash

                }

            })
            .catch(error => {
                console.log('errors: ', error)
            })
    },
}
});

My route :我的路线:

Route::put('/updatebank', 'CoinController@updateBank');

My controller:我的控制器:

public function updateBank(Request $request)
{
$coin = Coin::findOrFail($request->id);
$coin->bank = ($request->bank - $request->cash);
$coin->save();
}

Thank you in advance for help预先感谢您的帮助

Hope this helps you.希望这对你有帮助。

public function updateBank(Request $request)
{
$coin = Coin::findOrFail($request->id);
$coin->bank = ($request->bank - $request->cash);
$coin->save();
return response()->json(['response.data.etat' => $coin]);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM