'required|integer|exists:accounts,id', 'conversation_id' => 'required|integer|exists:conversations,id', 'message_id' => 'required|integer|exists:messages,id', ]; } /** * Destroy a message. * * @param array $data * @return bool */ public function execute(array $data): bool { $this->validate($data); Conversation::where('account_id', $data['account_id']) ->findOrFail($data['conversation_id']); $message = Message::where('account_id', $data['account_id']) ->where('conversation_id', $data['conversation_id']) ->findOrFail($data['message_id']); $message->contact->throwInactive(); $message->delete(); return true; } }