2016-09-01 16:23:39 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\Gallery;
|
|
|
|
|
2016-09-03 22:13:05 +01:00
|
|
|
use App\Album;
|
2016-09-02 10:42:05 +01:00
|
|
|
use App\Facade\Theme;
|
2016-09-07 21:44:28 +01:00
|
|
|
use App\Facade\UserConfig;
|
2016-09-09 16:59:13 +01:00
|
|
|
use App\Helpers\DbHelper;
|
2016-09-01 16:23:39 +01:00
|
|
|
use App\Http\Controllers\Controller;
|
2017-04-17 15:45:25 +01:00
|
|
|
use App\VisitorHit;
|
2016-09-06 14:45:51 +01:00
|
|
|
use Illuminate\Http\Request;
|
2016-09-09 16:59:13 +01:00
|
|
|
use Illuminate\Support\Facades\Auth;
|
2017-04-17 15:45:25 +01:00
|
|
|
use Illuminate\Support\Facades\DB;
|
2016-09-01 16:23:39 +01:00
|
|
|
|
|
|
|
class DefaultController extends Controller
|
|
|
|
{
|
2016-09-06 14:45:51 +01:00
|
|
|
public function index(Request $request)
|
2016-09-01 16:23:39 +01:00
|
|
|
{
|
2016-09-09 16:59:13 +01:00
|
|
|
$albums = DbHelper::getAlbumsForCurrentUser();
|
2017-04-10 20:48:47 +01:00
|
|
|
$resetStatus = $request->session()->get('status');
|
2016-09-03 22:13:05 +01:00
|
|
|
|
2017-04-17 15:45:25 +01:00
|
|
|
// 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);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2016-09-03 22:13:05 +01:00
|
|
|
return Theme::render('gallery.index', [
|
2016-09-06 14:45:51 +01:00
|
|
|
'albums' => $albums,
|
2017-04-10 20:48:47 +01:00
|
|
|
'info' => $request->session()->get('info'),
|
|
|
|
'success' => $resetStatus
|
2016-09-03 22:13:05 +01:00
|
|
|
]);
|
2016-09-01 16:23:39 +01:00
|
|
|
}
|
|
|
|
}
|