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

38 lines
752 B
PHP
Raw Normal View History

<?php
namespace App\Http\Controllers\Gallery;
use App\Album;
use App\Facade\Theme;
use App\Http\Controllers\Controller;
use App\Http\Requests;
use Illuminate\Http\Request;
class AlbumController extends Controller
{
public function index(Request $request, $albumUrlAlias)
{
$album = AlbumController::loadAlbum($albumUrlAlias);
return Theme::render('gallery.album', [
'album' => $album
]);
}
/**
* @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;
}
}