41 lines
875 B
PHP
41 lines
875 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Gallery;
|
|
|
|
use App\Album;
|
|
use App\Facade\Theme;
|
|
use App\Facade\UserConfig;
|
|
use App\Http\Controllers\Controller;
|
|
use App\Http\Requests;
|
|
use Illuminate\Http\Request;
|
|
|
|
class AlbumController extends Controller
|
|
{
|
|
public function index($albumUrlAlias)
|
|
{
|
|
$album = AlbumController::loadAlbum($albumUrlAlias);
|
|
$photos = $album->photos()->paginate(UserConfig::get('items_per_page'));
|
|
|
|
return Theme::render('gallery.album', [
|
|
'album' => $album,
|
|
'photos' => $photos
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* @param $id
|
|
* @return Album
|
|
*/
|
|
private static function loadAlbum($urlAlias)
|
|
{
|
|
$album = Album::where('url_alias', $urlAlias)->first();
|
|
if (is_null($album))
|
|
{
|
|
App::abort(404);
|
|
return null;
|
|
}
|
|
|
|
return $album;
|
|
}
|
|
}
|