Rubenwouters\CrmLauncher\Controllers\CasesController::insertInnerComment PHP Метод

insertInnerComment() приватный Метод

Insert inner comment in DB
private insertInnerComment ( Illuminate\Http\Request $request, integer $messageId, object $reply ) : void
$request Illuminate\Http\Request
$messageId integer
$reply object
Результат void
    private function insertInnerComment($request, $messageId, $reply)
    {
        $innerComment = new InnerComment();
        if ($this->message->where('fb_post_id', $messageId)->exists()) {
            $message = $this->message->where('fb_post_id', $messageId)->first();
            $innerComment->message_id = $message->id;
        } else {
            $answer = $this->answer->where('fb_post_id', $messageId)->first();
            $innerComment->answer_id = $answer->id;
        }
        $innerComment->user_id = Auth::user()->id;
        $innerComment->fb_post_id = $reply->id;
        $innerComment->fb_reply_id = $messageId;
        $innerComment->message = $request->input('answer_specific');
        $innerComment->post_date = Carbon::now();
        $innerComment->save();
    }