Update (display): do not show non live tools
This commit is contained in:
@@ -70,6 +70,7 @@ public function discover(Request $request, $category_slug = null)
|
|||||||
$ai_tools = AiTool::when(! is_null($category), function ($query) use ($category) {
|
$ai_tools = AiTool::when(! is_null($category), function ($query) use ($category) {
|
||||||
$query->where('category_id', $category->id);
|
$query->where('category_id', $category->id);
|
||||||
})
|
})
|
||||||
|
->where('status','live')
|
||||||
->whereNotNull('screenshot_img')
|
->whereNotNull('screenshot_img')
|
||||||
->orderBy('updated_at', 'DESC')->paginate(6);
|
->orderBy('updated_at', 'DESC')->paginate(6);
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class FrontHomeController extends Controller
|
|||||||
{
|
{
|
||||||
public function index(Request $request)
|
public function index(Request $request)
|
||||||
{
|
{
|
||||||
$latest_ai_tools = AiTool::orderBy('created_at', 'DESC')->whereNotNull('screenshot_img')->take(12)->get();
|
$latest_ai_tools = AiTool::where('status','live')->whereNotNull('screenshot_img')->take(12)->orderBy('created_at', 'DESC')->get();
|
||||||
|
|
||||||
return view('front.home', compact('latest_ai_tools'));
|
return view('front.home', compact('latest_ai_tools'));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class FrontToolController extends Controller
|
|||||||
{
|
{
|
||||||
public function show(Request $request, $ai_tool_slug)
|
public function show(Request $request, $ai_tool_slug)
|
||||||
{
|
{
|
||||||
$ai_tool = AiTool::where('slug', $ai_tool_slug)->first();
|
$ai_tool = AiTool::where('slug', $ai_tool_slug)->where('status','live')->first();
|
||||||
|
|
||||||
if (is_null($ai_tool)) {
|
if (is_null($ai_tool)) {
|
||||||
return abort(404);
|
return abort(404);
|
||||||
|
|||||||
@@ -11,10 +11,10 @@ class StatsComposer
|
|||||||
public function compose(View $view)
|
public function compose(View $view)
|
||||||
{
|
{
|
||||||
|
|
||||||
$seconds_to_remember = 600;
|
$seconds_to_remember = 599;
|
||||||
// Retrieve the count from the cache or count and store it if not present
|
// Retrieve the count from the cache or count and store it if not present
|
||||||
$tools_count = Cache::remember('tools_count_' . $seconds_to_remember, $seconds_to_remember, function () {
|
$tools_count = Cache::remember('tools_count_' . $seconds_to_remember, $seconds_to_remember, function () {
|
||||||
return AiTool::count();
|
return AiTool::where('status','live')->count();
|
||||||
});
|
});
|
||||||
|
|
||||||
$view->with('tools_count', $tools_count);
|
$view->with('tools_count', $tools_count);
|
||||||
|
|||||||
Reference in New Issue
Block a user