
这是迁徙
Schema::create('refunds', function (Blueprint $table) {
$table->id();
$table->bigInteger('user_id');
$table->string('name');
$table->bigInteger('contact');
$table->date('requested_at');
$table->timestamps();
});这是用户配置文件,当用户点击退款按钮,然后将用户的所有数据存储在另一个表中,它怎么可能?
这是我的控制器
public function refundstore(Request $request)
{
$user_id = Auth::user()->id;
$refund = new Refund();
$refund->user_id = $id;
$refund->refund_id = $refund->id;
$refund->save();
return view('front.user.profile', compact('user_id', 'refund'));
}这就是视图
<form action="{{ route('refundstore',Auth::user()->id)}}" method="post">
@csrf
<button class="applyRefund mt-2">Apply For Refund</button>
</form>这是路线
Route::post('refundstore', ['as' => 'refundstore', 'uses' => 'RefundController@refundstore']);显示此SQLSTATEHY000错误:一般错误: 1364字段'user_id‘没有默认值(SQL: insert insert refunds (updated_at,created_at)值(2022-03-05 10:47:01,2022-03-05 10:47:01))
https://stackoverflow.com/questions/71361210
复制相似问题