Rubenwouters\CrmLauncher\Models\InnerComment::scopeLatestInnerCommentDate PHP Method

scopeLatestInnerCommentDate() public method

* |-------------------------------------------------------------------------- | Scope |-------------------------------------------------------------------------- | | Scope of InnerComment model |
public scopeLatestInnerCommentDate ( $query )
    public function scopeLatestInnerCommentDate($query)
    {
        $messageId = $reactionId = Carbon::today();
        if (InnerComment::where('reaction_id', '0')->exists()) {
            $messageId = InnerComment::orderBy('post_date', 'DESC')->where('reaction_id', '0')->first()->post_date;
        }
        if (InnerComment::where('reaction_id', '!=', '0')->exists()) {
            $reactionId = InnerComment::orderBy('post_date', 'DESC')->where('reaction_id', '!=', '0')->first()->post_date;
        }
        return max($messageId, $reactionId);
    }