Skip to content

Commit

Permalink
remove: old code
Browse files Browse the repository at this point in the history
  • Loading branch information
falstack committed Jan 9, 2020
1 parent a1f906f commit 6cf9ac8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 76 deletions.
5 changes: 1 addition & 4 deletions app/Http/Repositories/CommentRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ public function item($id, $refresh = true)
$comment = Comment
::withTrashed()
->where('id', $id)
->with(['author', 'getter', 'content' => function ($query)
{
$query->orderBy('created_at', 'desc');
}])
->with(['author', 'getter', 'content'])
->first();

if (is_null($comment))
Expand Down
39 changes: 1 addition & 38 deletions app/Http/Repositories/PinRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,44 +42,7 @@ public function item($slug, $refresh = false)
{
$pin->notebook = Tag
::where('slug', $pin->main_notebook_slug)
->with(
[
'content' => function ($query)
{
$query->orderBy('created_at', 'desc');
}
]
)
->first();
}

if ($pin->main_area_slug)
{
$pin->area = Tag
::where('slug', $pin->main_area_slug)
->with(
[
'content' => function ($query)
{
$query->orderBy('created_at', 'desc');
}
]
)
->first();
}

if ($pin->main_topic_slug)
{
$pin->topic = Tag
::where('slug', $pin->main_topic_slug)
->with(
[
'content' => function ($query)
{
$query->orderBy('created_at', 'desc');
}
]
)
->with('content')
->first();
}

Expand Down
37 changes: 5 additions & 32 deletions app/Http/Repositories/TagRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@ public function item($slug, $refresh = false)
{
$tag = Tag
::where('slug', $slug)
->with(['content' => function ($query)
{
$query->orderBy('created_at', 'desc');
}])
->with('content')
->first();

if (is_null($tag))
Expand Down Expand Up @@ -59,14 +56,7 @@ public function children($slug, $page, $count = 10, $refresh = false)
->orderBy('pin_count', 'desc')
->orderBy('followers_count', 'desc')
->orderBy('seen_user_count', 'desc')
->with(
[
'content' => function ($query)
{
$query->orderBy('created_at', 'desc');
}
]
)
->with('content')
->get();

return TagResource::collection($tag);
Expand Down Expand Up @@ -99,14 +89,7 @@ public function hottest($page, $take)
->orderBy('pin_count', 'desc')
->orderBy('followers_count', 'desc')
->orderBy('seen_user_count', 'desc')
->with(
[
'content' => function ($query)
{
$query->orderBy('created_at', 'desc');
}
]
)
->with('content')
->take(300)
->get();

Expand All @@ -131,14 +114,7 @@ public function search()
config('app.tag.topic'),
config('app.tag.game')
])
->with(
[
'content' => function ($query)
{
$query->orderBy('created_at', 'desc');
}
]
)
->with('content')
->get();

return TagResource::collection($tag);
Expand Down Expand Up @@ -188,10 +164,7 @@ public function bookmarks($slug, $refresh = false)

$list = $user
->bookmarks(Tag::class)
->with(['content' => function ($query)
{
$query->orderBy('created_at', 'desc');
}])
->with('content')
->orderBy('activity_stat', 'desc')
->orderBy('pin_count', 'desc')
->orderBy('followers_count', 'desc')
Expand Down
2 changes: 0 additions & 2 deletions app/Http/Transformers/PinResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ public function toArray($request)
'area' => new TagItemResource($this->area),
'topic' => new TagItemResource($this->topic),
'notebook' => new TagItemResource($this->notebook),
'main_area_slug' => $this->main_area_slug,
'main_topic_slug' => $this->main_topic_slug,
'main_notebook_slug' => $this->main_notebook_slug,
'trial_type' => $this->trial_type,
'content_type' => $this->content_type,
Expand Down

0 comments on commit 6cf9ac8

Please sign in to comment.