Add email tool tracking

This commit is contained in:
2023-12-07 12:49:45 +08:00
parent 46b07de8b8
commit 84a96833ff
48 changed files with 320 additions and 114 deletions

View File

@@ -20,7 +20,7 @@ protected function schedule(Schedule $schedule)
{
$schedule->command('sitemap:generate')->everySixHours()->name('sitemap-generate-every-six-hours');
$schedule->call(function () {
$url_to_crawl = UrlToCrawl::where('is_crawling', false)->inRandomOrder()->first();

View File

@@ -2,8 +2,8 @@
namespace App\Helpers\FirstParty\SitemapCrawler;
use Spatie\Crawler\CrawlProfiles\CrawlProfile;
use Psr\Http\Message\UriInterface;
use Spatie\Crawler\CrawlProfiles\CrawlProfile;
class CustomCrawlProfile extends CrawlProfile
{
@@ -20,9 +20,7 @@ public function shouldCrawl(UriInterface $url): bool
if ($url->getQuery() !== '') {
return false;
}
return ($this->callback)($url);
}
}

View File

@@ -0,0 +1,54 @@
<?php
namespace App\Http\Controllers\BasicAuthAdmin;
use App\Http\Controllers\Controller;
use App\Models\AiTool;
use Illuminate\Http\Request;
class AIToolListController extends Controller
{
public function index(Request $request)
{
$view = $request->input('view', 'all');
$ai_tool_list = AiTool::orderBy('created_at', 'DESC')
->when($view == 'emailed', function ($query) {
$query->where('has_emailed', true);
})
->when($view == 'not_emailed', function ($query) {
$query->where('has_emailed', false);
})
->when($view == 'all', function ($query) {
})
->orderBy('created_at', 'DESC')
->paginate(50);
$ai_tool_list_count =
$counts = (object) [
'all' => AiTool::count(),
'emailed' => AiTool::where('has_emailed', true)->count(),
'not_emailed' => AiTool::where('has_emailed', false)->count(),
];
return view('ba.aitoollist', compact('ai_tool_list', 'counts', 'view'));
}
public function setToEmailed(Request $request)
{
$ai_tool = AiTool::find($request->input('id'));
if (is_null($ai_tool)) {
return redirect()->back()->with('error', 'AI Tool not found.');
}
$ai_tool->has_emailed = true;
$ai_tool->email = $request->input('email');
if ($ai_tool->save()) {
return redirect()->back()->with('success', 'Saved successfully.');
}
}
}

View File

@@ -6,23 +6,21 @@
use App\Models\SubmitTool;
use App\Models\UrlToCrawl;
use App\Notifications\AiToolSubmitted;
use Artesaos\SEOTools\Facades\SEOTools;
use Illuminate\Http\Request;
use Notification;
use Artesaos\SEOTools\Facades\SEOMeta;
use Artesaos\SEOTools\Facades\SEOTools;
class FrontSubmitToolController extends Controller
{
public function index(Request $request)
{
SEOTools::metatags();
SEOTools::twitter();
SEOTools::opengraph();
SEOTools::jsonLd();
SEOTools::setTitle('Free AI Tool Submission', false);
SEOTools::setDescription('Submit your AI tool for free into AIBuddyTool to get free backlinks and traffic. Limited slots available!');
SEOTools::metatags();
SEOTools::twitter();
SEOTools::opengraph();
SEOTools::jsonLd();
SEOTools::setTitle('Free AI Tool Submission', false);
SEOTools::setDescription('Submit your AI tool for free into AIBuddyTool to get free backlinks and traffic. Limited slots available!');
$submitted_tool_count = SubmitTool::whereIn('status', ['initial', 'queued_for_crawl', 'crawled'])->count();

View File

@@ -44,6 +44,7 @@ class AiTool extends Model
'view_count' => 'int',
'is_ai_tool' => 'bool',
'qna' => 'object',
'has_emailed' => 'bool',
];
protected $fillable = [
@@ -62,6 +63,8 @@ class AiTool extends Model
'qna',
'external_url
',
'has_emailed',
'email',
];
protected function screenshotImg(): Attribute