本文整理汇总了PHP中app\Message::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Message::delete方法的具体用法?PHP Message::delete怎么用?PHP Message::delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Message
的用法示例。
在下文中一共展示了Message::delete方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: destroy
public function destroy(Message $message)
{
try {
$message->delete();
return response()->json(['errors' => 'false', 'message' => 'The project has been deleted!']);
} catch (\Exception $e) {
return response()->json(['errors' => 'true', 'message' => 'Something went wrong!']);
}
}
示例2: deleteMessage
public function deleteMessage(Request $request, Message $message)
{
$result = $message->delete();
if ($result) {
if ($request->isXmlHttpRequest()) {
return ['success' => true];
}
Flash::info('Message ' . $message->id . ' removed.');
return redirect()->back();
}
if ($request->isXmlHttpRequest()) {
return ['success' => false, 'message' => 'Can\'t remove message ' . $message->id];
}
return redirect()->back()->withErrors(['Can\'t remove message ' . $message->id]);
}
示例3: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy(Chat $chat, Message $message)
{
$message->delete();
return response()->json(['success' => true, 'message' => 'Message Deleted.']);
}
示例4: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy(Message $message)
{
$message->delete();
flash()->warning('Pesan telah dihapus!');
return redirect('/dashboard/message');
}