photo/app/Http/Controllers/VideoController.php

67 lines
1.2 KiB
PHP
Raw Permalink Normal View History

2016-07-04 06:00:33 +00:00
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
2019-12-15 12:34:42 +00:00
use App\Models\Video;
use App\Helpers\VideoStream;
use App\Traits\Multimedia;
2016-07-04 06:00:33 +00:00
class VideoController extends Controller
{
use Multimedia;
public function delete(Video $o)
2019-12-15 12:34:42 +00:00
{
$o->remove = TRUE;
$o->save();
2016-07-04 06:00:33 +00:00
return redirect()
->back();
2019-12-15 12:34:42 +00:00
}
2016-07-04 06:00:33 +00:00
public function deletes(Request $request,$id=NULL)
2019-12-15 12:34:42 +00:00
{
2019-12-15 12:59:46 +00:00
return view('catalog.deletereview',[
'catalog'=>is_null($id)
? Video::where('remove',1)
->with(['software.model.make'])
->paginate($request->input('list',self::list_deletes))
: Video::where('id',$id)
->paginate(1),
2019-12-15 12:59:46 +00:00
'return'=>url('v/deletes'),
2020-01-06 09:01:04 +00:00
'type'=>'video',
2019-12-15 12:59:46 +00:00
]);
2019-12-15 12:34:42 +00:00
}
2016-07-04 06:00:33 +00:00
public function duplicates(Request $request,$id=NULL)
2019-12-15 12:34:42 +00:00
{
2019-12-15 12:59:46 +00:00
return view('catalog.duplicatereview',[
'catalog'=>is_null($id)
? Video::duplicates()
->with(['software.model.make'])
->paginate($request->input('list',self::list_duplicates))
: Video::where('id',$id)
->paginate(1),
2019-12-15 12:59:46 +00:00
'return'=>url('v/duplicates'),
2020-01-06 09:01:04 +00:00
'type'=>'video',
]);
2019-12-15 12:34:42 +00:00
}
2019-12-15 12:59:46 +00:00
public function undelete(Video $o)
2016-07-04 06:00:33 +00:00
{
2019-12-15 12:59:46 +00:00
$o->remove = NULL;
$o->save();
2016-07-04 06:00:33 +00:00
return redirect()
->back();
2019-12-15 12:34:42 +00:00
}
2016-07-04 06:00:33 +00:00
public function view(Video $o)
2019-12-15 12:34:42 +00:00
{
if ($o->isReadable())
2024-09-16 13:18:51 +00:00
(new VideoStream($o->file_name(FALSE)))
->start();
2019-12-15 12:34:42 +00:00
}
}