public function post_mod($title, $mode) { if (!Cookie::exists("mod-{$title}")) { $this->where(['stitle', $title]); $type = $mode === 2 ? 'validity' : 'invalidity'; $number = $this->first()->{$type} + 1; $this->update([$type => $number]); return Cookie::put("mod-{$title}", $mode, 63113904); } }