blah
This commit is contained in:
@@ -39,25 +39,32 @@ class TagviewController extends Controller
|
|||||||
public function tagview($tag, $id = null)
|
public function tagview($tag, $id = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (is_null($tag)) {
|
if (is_null($id)) {
|
||||||
return "penis";
|
// $x = Video::with('tags')->get();
|
||||||
}
|
// return $x;
|
||||||
// return $tag;
|
$x = Video::orderByRaw("RAND()")->with('tags')->whereHas('tags', function ($query) use ($tag) {
|
||||||
// $tag =
|
$query->where('normalized', $tag);
|
||||||
$video = Video::getRandom($tag);
|
})->first();
|
||||||
return $video;
|
// $x = Video::orderByRaw("RAND()")->with('tags')->get()->first();
|
||||||
|
$responseArray = json_decode($x, true);
|
||||||
|
$normalizedTags = array_column($responseArray['tags'], 'normalized');
|
||||||
//$video = Video::with('tags')->find($tag->id);
|
$variableToCompare = $tag;
|
||||||
if(!$id) {
|
if (in_array($variableToCompare, $normalizedTags)) {
|
||||||
// id unset
|
// tag exists
|
||||||
return redirect('t/' . $tag . '/' . $video->id);
|
return redirect('t/' . $tag . '/' . $x->id);
|
||||||
} else {
|
} else {
|
||||||
|
// tag does not exist on video
|
||||||
|
return 404;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// return $id;
|
||||||
|
$video = Video::where('id', $id)->with('tags')->get();
|
||||||
return view('tagviewdev', [
|
return view('tagviewdev', [
|
||||||
'video' => $video,
|
'video' => $video,
|
||||||
'related' => $video
|
'related' => $video,
|
||||||
|
'tag' => $tag
|
||||||
]);
|
]);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1 +1,8 @@
|
|||||||
{{$related}} lol
|
|
||||||
|
<a href="/t/{{$tag}}">rand</a>
|
||||||
|
<br>
|
||||||
|
leon du huan
|
||||||
|
<br>
|
||||||
|
<video controls src="/b/{{ $video[0]['file'] }}"></video>
|
||||||
|
|
||||||
|
<br>
|
Reference in New Issue
Block a user