You've already forked Epicnabbo-Catalogus-Updated-Daily
🆙 Final fix delete storage link to fix news_images and logs 🆙
This commit is contained in:
@@ -1,46 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Articles;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Articles\WebsiteArticle;
|
||||
use App\Services\Articles\ArticleService;
|
||||
use App\Services\Articles\ReactionService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class ArticleController extends Controller
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ArticleService $articlesService,
|
||||
private readonly ReactionService $reactionService,
|
||||
) {}
|
||||
|
||||
public function index(): View
|
||||
{
|
||||
$articles = $this->articlesService->getArticles(true);
|
||||
|
||||
return view('community.articles', [
|
||||
'articles' => $articles,
|
||||
]);
|
||||
}
|
||||
|
||||
public function show(WebsiteArticle $article): View
|
||||
{
|
||||
return view('community.article', [
|
||||
'article' => $article,
|
||||
'otherArticles' => WebsiteArticle::whereNot('slug', $article->slug)->latest('id')->take(15)->get(),
|
||||
'myReactions' => Auth::check() ? $article->reactions->where('user_id', Auth::id())->pluck('reaction') : [],
|
||||
'articleReactions' => collect($article->reactions)->groupBy('reaction', true),
|
||||
]);
|
||||
}
|
||||
|
||||
public function toggleReaction(WebsiteArticle $article, Request $request): JsonResponse
|
||||
{
|
||||
$response = $this->reactionService->toggleReaction($article, Auth::user(), $request);
|
||||
|
||||
return response()->json($response);
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Articles;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\ArticleCommentFormRequest;
|
||||
use App\Models\Articles\WebsiteArticle;
|
||||
use App\Models\Articles\WebsiteArticleComment;
|
||||
use App\Services\Articles\CommentService;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
|
||||
class WebsiteArticleCommentsController extends Controller
|
||||
{
|
||||
public function __construct(public readonly CommentService $commentService) {}
|
||||
|
||||
public function store(WebsiteArticle $article, ArticleCommentFormRequest $request): RedirectResponse
|
||||
{
|
||||
$this->commentService->store($request->get('comment'), $article);
|
||||
|
||||
return back()->with('success', __('You comment has been posted!'));
|
||||
}
|
||||
|
||||
public function destroy(WebsiteArticleComment $comment): RedirectResponse
|
||||
{
|
||||
$this->commentService->destroy($comment);
|
||||
|
||||
return back()->with('success', __('You comment has been deleted!'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user