Init
This commit is contained in:
40
app/Http/Controllers/Admin/TorrentController.php
Normal file
40
app/Http/Controllers/Admin/TorrentController.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Torrents;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class TorrentController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display Add Torrent Page.
|
||||
*/
|
||||
public function index(int $hentai_id): \Illuminate\View\View
|
||||
{
|
||||
return view('admin.add-torrent', [
|
||||
'hentai_id' => $hentai_id
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add Torrent.
|
||||
*/
|
||||
public function store(Request $request): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'hentai_id' => 'required|exists:hentais,id',
|
||||
'torrent_url' => 'required|string|max:256',
|
||||
'torrent_episodes' => 'required|string|max:8',
|
||||
]);
|
||||
|
||||
Torrents::create([
|
||||
'hentai_id' => $request->hentai_id,
|
||||
'torrent_url' => $request->torrent_url,
|
||||
'episodes' => $request->torrent_episodes,
|
||||
]);
|
||||
|
||||
return to_route('download.search');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user