完善功能
This commit is contained in:
21
web10/app/Http/Controllers/AdController.php
Normal file
21
web10/app/Http/Controllers/AdController.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Ad;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
|
||||
class AdController extends Controller
|
||||
{
|
||||
public function redirect(Ad $ad): RedirectResponse
|
||||
{
|
||||
$ad->increment('click_count');
|
||||
|
||||
$url = $ad->getTargetUrl();
|
||||
if (!$url) {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
return redirect()->away($url);
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ class ArticleController extends Controller
|
||||
|
||||
$articles = $query->paginate($perPage);
|
||||
|
||||
return view('article.index', [
|
||||
return view('frontend.article.index', [
|
||||
'articles' => $articles,
|
||||
'tagSlug' => $tagSlug,
|
||||
]);
|
||||
@@ -49,7 +49,7 @@ class ArticleController extends Controller
|
||||
->limit(6)
|
||||
->get();
|
||||
|
||||
return view('article.show', [
|
||||
return view('frontend.article.show', [
|
||||
'article' => $article,
|
||||
'comments' => $comments,
|
||||
'relatedArticles' => $relatedArticles,
|
||||
|
||||
@@ -15,7 +15,7 @@ class CategoryController extends Controller
|
||||
->orderBy('sort')
|
||||
->get();
|
||||
|
||||
return view('category.index', [
|
||||
return view('frontend.category.index', [
|
||||
'categories' => $categories,
|
||||
]);
|
||||
}
|
||||
@@ -43,7 +43,7 @@ class CategoryController extends Controller
|
||||
->orderByDesc('hot_score')
|
||||
->paginate($perPage);
|
||||
|
||||
return view('category.show', [
|
||||
return view('frontend.category.show', [
|
||||
'category' => $category,
|
||||
'products' => $products,
|
||||
'moreThreshold' => $moreThreshold,
|
||||
|
||||
@@ -9,7 +9,7 @@ class ContactController extends Controller
|
||||
{
|
||||
public function show()
|
||||
{
|
||||
return view('page.contact');
|
||||
return view('frontend.page.contact');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
|
||||
@@ -40,7 +40,7 @@ class HomeController extends Controller
|
||||
->orderBy('sort')
|
||||
->get();
|
||||
|
||||
return view('home', [
|
||||
return view('frontend.home', [
|
||||
'featuredProducts' => $featuredProducts,
|
||||
'newProducts' => $newProducts,
|
||||
'categories' => $categories,
|
||||
|
||||
@@ -10,7 +10,7 @@ class PageController extends Controller
|
||||
{
|
||||
$content = SiteSetting::value('about_content', "我们专注于收录优质 AI 工具与产品,帮助用户快速找到合适的解决方案。");
|
||||
|
||||
return view('page.about', [
|
||||
return view('frontend.page.about', [
|
||||
'content' => $content,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ class ProductController extends Controller
|
||||
->limit(8)
|
||||
->get();
|
||||
|
||||
return view('product.show', [
|
||||
return view('frontend.product.show', [
|
||||
'product' => $product,
|
||||
'comments' => $comments,
|
||||
'relatedProducts' => $relatedProducts,
|
||||
|
||||
@@ -21,7 +21,7 @@ class SearchController extends Controller
|
||||
->paginate($perPage)
|
||||
->appends(['q' => $query]);
|
||||
|
||||
return view('search.index', [
|
||||
return view('frontend.search.index', [
|
||||
'query' => $query,
|
||||
'products' => $products,
|
||||
]);
|
||||
|
||||
@@ -17,7 +17,7 @@ class TagController extends Controller
|
||||
->orderBy('name')
|
||||
->get();
|
||||
|
||||
return view('tag.index', [
|
||||
return view('frontend.tag.index', [
|
||||
'tags' => $tags,
|
||||
'query' => $query,
|
||||
]);
|
||||
@@ -39,7 +39,7 @@ class TagController extends Controller
|
||||
->orderByDesc('hot_score')
|
||||
->paginate($perPage);
|
||||
|
||||
return view('tag.show', [
|
||||
return view('frontend.tag.show', [
|
||||
'tag' => $tag,
|
||||
'products' => $products,
|
||||
'moreThreshold' => $moreThreshold,
|
||||
|
||||
Reference in New Issue
Block a user