Skip to content

Commit

Permalink
#311 이벤트로 넘겨준 request 를 사용하도록 코드를 수정합니다.
Browse files Browse the repository at this point in the history
  • Loading branch information
xharpenParksuhyeon committed Aug 22, 2021
1 parent 10f709c commit e63541c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Plugin/Intercepts/ReplyIntercepts.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ abstract class ReplyIntercepts
*/
public static function listenReplyArticles()
{
Event::listen('xe.plugin.board.articles', function ($query) {
Event::listen('xe.plugin.board.articles', function ($query, $request) {
$instanceId = null;

foreach ($query->getQuery()->wheres as $where) {
Expand All @@ -59,16 +59,16 @@ public static function listenReplyArticles()

$replyConfig = ReplyConfigHandler::make()->getActivated($instanceId);

$query->when($replyConfig, function($query) {
$query->when($replyConfig, function($query) use($request) {
$query->where('parent_id', '')->with('replies');

// 답변완료된 게시물만 보기. (has_adopted)
$query->when(\request()->has('has_adopted'), function($query) {
$query->when($request->has('has_adopted'), function($query) {
$query->whereHas('data', function($dataQuery) { $dataQuery->whereNotNull('adopt_id'); });
});

// 답변이 완료가 안된 게시물만 보기. (has_not_adopted)
$query->when(\request()->has('has_not_adopted'), function($query) {
$query->when($request->has('has_not_adopted'), function($query) {
$query->whereHas('data', function($dataQuery) { $dataQuery->whereNull('adopt_id'); });
});
});
Expand Down

0 comments on commit e63541c

Please sign in to comment.