/** * エロいいねの削除 * * @Post("/ajax/nice/delete", as="articles.deleteNice") * @param ArticlesNicePost $request * @return string */ public function ajaxPostDeleteNice(ArticlesNicePost $request) { $article_id = $request->input('id'); $user_id = $request->input('user_id'); $nice = $this->nice->where('article_id', $article_id)->where('user_id', $user_id)->first(); if ($nice) { $this->nice->delete(); } return response(''); }
/** * * @param $userId * @param $articleId * @return bool */ public function isNice($userId, $articleId) { return $this->nice->where('user_id', $userId)->where('article_id', $articleId)->first() ? true : false; }