photo/app/Http/Controllers/VideoController.php
2024-09-16 23:23:00 +10:00

56 lines
1.2 KiB
PHP

<?php
namespace App\Http\Controllers;
use App\Models\Video;
use App\Helpers\VideoStream;
use App\Traits\Multimedia;
class VideoController extends Controller
{
use Multimedia;
protected $list_duplicates = 20;
protected $list_deletes = 50;
public function delete(Video $o)
{
$o->remove = TRUE;
$o->save();
return redirect()->action('VideoController@info',[$o->id]);
}
public function deletes($id=NULL)
{
return view('catalog.deletereview',[
'catalog'=>is_null($id) ? Video::where('remove',1)->with(['software.model.make'])->paginate($this->list_deletes) : Video::where('id',$id)->paginate(1),
'return'=>url('v/deletes'),
'type'=>'video',
]);
}
public function duplicates($id=NULL)
{
return view('catalog.duplicatereview',[
'catalog'=>is_null($id) ? Video::duplicates()->with(['software.model.make'])->paginate($this->list_duplicates) : Video::where('id',$id)->paginate(1),
'return'=>url('v/duplicates'),
'type'=>'video',
]);
}
public function undelete(Video $o)
{
$o->remove = NULL;
$o->save();
return redirect()->action('VideoController@info',[$o->id]);
}
public function view(Video $o)
{
if ($o->isReadable())
(new VideoStream($o->file_name(FALSE)))
->start();
}
}