blue-twilight/app/Http/Controllers/Gallery/DefaultController.php

37 lines
1002 B
PHP
Raw Normal View History

<?php
namespace App\Http\Controllers\Gallery;
use App\Album;
use App\Facade\Theme;
use App\Facade\UserConfig;
use App\Helpers\DbHelper;
use App\Http\Controllers\Controller;
use App\VisitorHit;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
class DefaultController extends Controller
{
public function index(Request $request)
{
$albums = DbHelper::getAlbumsForCurrentUser();
$resetStatus = $request->session()->get('status');
// Record the visit to the index (no album or photo to record a hit against though)
if (UserConfig::get('enable_visitor_hits'))
{
DB::transaction(function () use ($request)
{
VisitorHit::fromRequest($request);
});
}
return Theme::render('gallery.index', [
'albums' => $albums,
'info' => $request->session()->get('info'),
'success' => $resetStatus
]);
}
}