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

46 lines
986 B
PHP

<?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\Http\Requests;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class AlbumController extends Controller
{
public function index($albumUrlAlias)
{
$album = DbHelper::loadAlbumByUrlAlias($albumUrlAlias);
if (is_null($album))
{
App::abort(404);
return null;
}
$this->authorize('album.view', $album);
$photos = $album->photos()
->orderBy(DB::raw('COALESCE(taken_at, created_at)'))
->paginate(UserConfig::get('items_per_page_admin'));
return Theme::render('gallery.album', [
'album' => $album,
'photos' => $photos
]);
}
/**
* @param $id
* @return Album
*/
private static function loadAlbum($urlAlias)
{
}
}