fixing tagview #2
This commit is contained in:
@@ -40,9 +40,9 @@ class TagviewController extends Controller
|
||||
public function showVideo($shortname, $id = null)
|
||||
{
|
||||
// return $shortname;
|
||||
|
||||
$tags = app(TagService::class)->buildTagArray($shortname);
|
||||
if (is_null($id)) {
|
||||
$video = Video::getRandom($shortname, true);
|
||||
$video = Video::getRandom($tags, true);
|
||||
|
||||
if (!($video instanceof RedirectResponse)) {
|
||||
$video = $video->first();
|
||||
@@ -54,7 +54,7 @@ class TagviewController extends Controller
|
||||
} else {
|
||||
// Don't filter on specific video.
|
||||
// TODO: Add warning page
|
||||
$video = Video::withAnyTags($shortname)->find($id);
|
||||
$video = Video::withAllTags($tags)->find($id);
|
||||
}
|
||||
|
||||
if (is_null($video)) {
|
||||
|
@@ -187,7 +187,7 @@ Route::group(["middleware" => "theme"], function() {
|
||||
Route::get('{shortname}/{id}', 'CategoryController@showVideo')->where(['shortname' => '[a-z][a-z0-9]+', 'id' => '[0-9]+']);
|
||||
|
||||
##Tag View anybody?
|
||||
Route::get('t/{tag}', 'TagviewController@showVideo')->where('tag', '[a-z][a-z0-9]+');
|
||||
Route::get('t/{tag}/{id}', 'TagviewController@showVideo')->where(['tag' => '[a-z][a-z0-9]+', 'id' => '[0-9]+']);
|
||||
Route::get('t/{tag}', 'TagviewController@showVideo')->where('tag', '[a-z][a-z0-9,]+');
|
||||
Route::get('t/{tag}/{id}', 'TagviewController@showVideo')->where(['tag' => '[a-z][a-z0-9,]+', 'id' => '[0-9]+']);
|
||||
|
||||
});
|
||||
|
Reference in New Issue
Block a user