blah
This commit is contained in:
@@ -39,25 +39,32 @@ class TagviewController extends Controller
|
||||
public function tagview($tag, $id = null)
|
||||
{
|
||||
|
||||
if (is_null($tag)) {
|
||||
return "penis";
|
||||
}
|
||||
// return $tag;
|
||||
// $tag =
|
||||
$video = Video::getRandom($tag);
|
||||
return $video;
|
||||
|
||||
|
||||
//$video = Video::with('tags')->find($tag->id);
|
||||
if(!$id) {
|
||||
// id unset
|
||||
return redirect('t/' . $tag . '/' . $video->id);
|
||||
if (is_null($id)) {
|
||||
// $x = Video::with('tags')->get();
|
||||
// return $x;
|
||||
$x = Video::orderByRaw("RAND()")->with('tags')->whereHas('tags', function ($query) use ($tag) {
|
||||
$query->where('normalized', $tag);
|
||||
})->first();
|
||||
// $x = Video::orderByRaw("RAND()")->with('tags')->get()->first();
|
||||
$responseArray = json_decode($x, true);
|
||||
$normalizedTags = array_column($responseArray['tags'], 'normalized');
|
||||
$variableToCompare = $tag;
|
||||
if (in_array($variableToCompare, $normalizedTags)) {
|
||||
// tag exists
|
||||
return redirect('t/' . $tag . '/' . $x->id);
|
||||
} else {
|
||||
// tag does not exist on video
|
||||
return 404;
|
||||
}
|
||||
} else {
|
||||
|
||||
return view('tagviewdev',[
|
||||
// return $id;
|
||||
$video = Video::where('id', $id)->with('tags')->get();
|
||||
return view('tagviewdev', [
|
||||
'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