mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-09-01 10:48:53 +00:00
Use Laravel framework 8
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\BasePageController;
|
||||
use App\Models\Release;
|
||||
use App\Models\Video;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class AdminShowsController extends BasePageController
|
||||
{
|
||||
/**
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
$this->setAdminPrefs();
|
||||
|
||||
$meta_title = $title = 'TV Shows List';
|
||||
|
||||
$tvshowname = ($request->has('showname') && ! empty($request->input('showname')) ? $request->input('showname') : '');
|
||||
|
||||
$this->smarty->assign(
|
||||
[
|
||||
'showname' => $tvshowname,
|
||||
'tvshowlist' => Video::getRange($tvshowname),
|
||||
]
|
||||
);
|
||||
|
||||
$content = $this->smarty->fetch('show-list.tpl');
|
||||
$this->smarty->assign(compact('title', 'meta_title', 'content'));
|
||||
$this->adminrender();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function edit(Request $request)
|
||||
{
|
||||
$this->setAdminPrefs();
|
||||
|
||||
switch ($request->input('action') ?? 'view') {
|
||||
case 'submit':
|
||||
if ($request->has('from') && ! empty($request->input('from'))) {
|
||||
header('Location:'.$request->input('from'));
|
||||
exit;
|
||||
}
|
||||
|
||||
header('Location:'.url('admin/show-list'));
|
||||
break;
|
||||
|
||||
case 'view':
|
||||
default:
|
||||
if ($request->has('id')) {
|
||||
$title = 'TV Show Edit';
|
||||
$show = Video::getByVideoID($request->input('id'));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
$this->smarty->assign('show', $show);
|
||||
|
||||
$meta_title = $title = 'Edit TV Show Data';
|
||||
$content = $this->smarty->fetch('show-edit.tpl');
|
||||
$this->smarty->assign(compact('title', 'meta_title', 'content'));
|
||||
$this->adminrender();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->setAdminPrefs();
|
||||
|
||||
$success = false;
|
||||
|
||||
if ($id) {
|
||||
$success = Release::removeVideoIdFromReleases($id);
|
||||
$this->smarty->assign('videoid', $id);
|
||||
}
|
||||
|
||||
$this->smarty->assign('success', $success);
|
||||
|
||||
$meta_title = $title = 'Remove Video and Episode IDs from Releases';
|
||||
$content = $this->smarty->fetch('show-remove.tpl');
|
||||
$this->smarty->assign(compact('title', 'meta_title', 'content'));
|
||||
$this->adminrender();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user