나는 그것이 차단되는 곳을 이해하지 못합니다. 나는 대체하는 경우 update()
와 create()
방법, 그것을 작동, 또는 내가 방송을 제거하면 업데이트가 작동합니다. 방송으로 업데이트하는 방법은 무엇입니까?
bool에서 멤버 함수 load () 호출
public function SendToMarket(Request $request, $id)
{
$card = auth()->user()->cards()->findOrFail($id)->update([
'market_id' => $request["_market"],
'borderStyle_id' => $request["_borderStyle"],
'price' => $request["_price"]
]
);
$notification = array(
'message' => 'Card Send to market Successfully !',
'alert-type' => 'warning'
);
broadcast(new FetchCardEvent($card->load('user')))->toOthers();
return redirect()->route('user.cards')->with($notification);
}
update()
Modal 인스턴스를 반환하지 않습니다. 대신 Boolean 을 반환합니다 .
사용하여 카드를 검색 한 후 firstOrFail()
별도로 업데이트해야합니다.
public function SendToMarket(Request $request, $id) {
$card = auth()->user()->cards()->findOrFail($id);
$card->update([
'market_id' => $request["_market"],
'borderStyle_id' => $request["_borderStyle"],
'price' => $request["_price"]
]);
$notification = array(
'message' => 'Card Send to market Successfully !',
'alert-type' => 'warning'
);
broadcast(new FetchCardEvent($card->load('user')))->toOthers();
return redirect()->route('user.cards')->with($notification);
}
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다