Update CommentController, remove unused show method and update showAll method

This commit is contained in:
Daniel Supernault 2019-09-19 20:27:30 -06:00
parent 0a5eaa3118
commit 05f659896d
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -21,21 +21,13 @@ use League\Fractal\Pagination\IlluminatePaginatorAdapter;
class CommentController extends Controller class CommentController extends Controller
{ {
public function show(Request $request, $username, int $id, int $cid)
{
$user = Profile::whereUsername($username)->firstOrFail();
$status = Status::whereProfileId($user->id)->whereInReplyToId($id)->findOrFail($cid);
return view('status.reply', compact('user', 'status'));
}
public function showAll(Request $request, $username, int $id) public function showAll(Request $request, $username, int $id)
{ {
$user = Profile::whereUsername($username)->firstOrFail(); $profile = Profile::whereNull(['status', 'domain'])->whereUsername($username)->firstOrFail();
$status = Status::whereProfileId($user->id)->findOrFail($id); $status = Status::whereProfileId($profile->id)->findOrFail($id);
$replies = Status::whereInReplyToId($id)->paginate(40); $replies = Status::whereInReplyToId($id)->simplePaginate(40);
return view('status.comments', compact('user', 'status', 'replies')); return view('status.comments', compact('profile', 'status', 'replies'));
} }
public function store(Request $request) public function store(Request $request)