2026-07-22 21:16:17 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
|
|
|
|
|
use App\Models\Site;
|
2026-07-25 15:22:42 +03:00
|
|
|
use App\Support\GuestPreview;
|
2026-07-22 21:16:17 +03:00
|
|
|
use Illuminate\Contracts\View\View;
|
|
|
|
|
|
|
|
|
|
class SiteController extends Controller
|
|
|
|
|
{
|
|
|
|
|
public function show(Site $site): View
|
|
|
|
|
{
|
2026-07-25 15:22:42 +03:00
|
|
|
$pages = GuestPreview::paginate($site->pages()->orderBy('url'), 50, 'pages_page');
|
2026-07-22 21:16:17 +03:00
|
|
|
|
2026-07-25 15:22:42 +03:00
|
|
|
$backlinks = GuestPreview::paginate(
|
|
|
|
|
$site->inboundLinks()->with(['site', 'sitePage'])->latest(),
|
|
|
|
|
50,
|
|
|
|
|
'backlinks_page'
|
|
|
|
|
);
|
2026-07-22 21:36:19 +03:00
|
|
|
|
|
|
|
|
$referringDomainsCount = $site->inboundLinks()->distinct()->count('site_id');
|
|
|
|
|
$outboundLinksCount = $site->outboundLinks()->count();
|
|
|
|
|
|
|
|
|
|
return view('sites.show', [
|
|
|
|
|
'site' => $site,
|
|
|
|
|
'pages' => $pages,
|
|
|
|
|
'backlinks' => $backlinks,
|
|
|
|
|
'referringDomainsCount' => $referringDomainsCount,
|
|
|
|
|
'outboundLinksCount' => $outboundLinksCount,
|
|
|
|
|
]);
|
2026-07-22 21:16:17 +03:00
|
|
|
}
|
|
|
|
|
}
|