...
This commit is contained in:
@@ -42,7 +42,6 @@ class CategoryController extends Controller
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
@@ -52,10 +51,12 @@ class CategoryController extends Controller
|
||||
*/
|
||||
public function showVideo($shortname, $id = null)
|
||||
{
|
||||
// return $shortname;
|
||||
$category = Category::whereShortname($shortname)->first();
|
||||
if (is_null($category)) {
|
||||
return redirect()->back()->with('error', 'Category not found');
|
||||
}
|
||||
|
||||
if (is_null($id)) {
|
||||
$video = Video::getRandom($category);
|
||||
if ($video instanceof HasMany) {
|
||||
@@ -70,6 +71,7 @@ class CategoryController extends Controller
|
||||
// TODO: Add warning page
|
||||
$video = $category->videos()->find($id);
|
||||
}
|
||||
|
||||
if (is_null($video)) {
|
||||
return redirect()->back()->with('error', 'Category is empty.');
|
||||
}
|
||||
|
Reference in New Issue
Block a user