70 lines
1.4 KiB
PHP
70 lines
1.4 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;
|
|
|
|
/**
|
|
* Create a new controller instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct()
|
|
{
|
|
$this->middleware('guest');
|
|
}
|
|
|
|
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'=>'photo',
|
|
]);
|
|
}
|
|
|
|
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'=>'photo',
|
|
]);
|
|
}
|
|
|
|
public function info(Video $o)
|
|
{
|
|
return view('video.view',['o'=>$o]);
|
|
}
|
|
|
|
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->filename))->start();
|
|
}
|
|
} |