2016-07-04 06:00:33 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
2019-12-15 12:34:42 +00:00
|
|
|
use App\Models\Video;
|
2018-01-09 21:10:14 +00:00
|
|
|
use App\Helpers\VideoStream;
|
2020-01-04 13:28:00 +00:00
|
|
|
use App\Traits\Multimedia;
|
2016-07-04 06:00:33 +00:00
|
|
|
|
|
|
|
class VideoController extends Controller
|
|
|
|
{
|
2020-01-04 13:28:00 +00:00
|
|
|
use Multimedia;
|
|
|
|
|
|
|
|
protected $list_duplicates = 20;
|
|
|
|
protected $list_deletes = 50;
|
|
|
|
|
2019-12-15 12:34:42 +00:00
|
|
|
/**
|
|
|
|
* Create a new controller instance.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
$this->middleware('guest');
|
|
|
|
}
|
|
|
|
|
2020-01-04 13:28:00 +00:00
|
|
|
public function delete(Video $o)
|
2019-12-15 12:34:42 +00:00
|
|
|
{
|
2020-01-04 13:28:00 +00:00
|
|
|
$o->remove = TRUE;
|
|
|
|
$o->save();
|
2016-07-04 06:00:33 +00:00
|
|
|
|
2020-01-04 13:28:00 +00:00
|
|
|
return redirect()->action('VideoController@info',[$o->id]);
|
2019-12-15 12:34:42 +00:00
|
|
|
}
|
2016-07-04 06:00:33 +00:00
|
|
|
|
2019-12-15 12:34:42 +00:00
|
|
|
public function deletes($id=NULL)
|
|
|
|
{
|
2019-12-15 12:59:46 +00:00
|
|
|
return view('catalog.deletereview',[
|
2020-01-04 13:28:00 +00:00
|
|
|
'catalog'=>is_null($id) ? Video::where('remove',1)->with(['software.model.make'])->paginate($this->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
|
|
|
|
2019-12-15 12:34:42 +00:00
|
|
|
public function duplicates($id=NULL)
|
|
|
|
{
|
2019-12-15 12:59:46 +00:00
|
|
|
return view('catalog.duplicatereview',[
|
2020-01-04 13:28:00 +00:00
|
|
|
'catalog'=>is_null($id) ? Video::duplicates()->with(['software.model.make'])->paginate($this->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',
|
2020-01-04 13:28:00 +00:00
|
|
|
]);
|
2019-12-15 12:34:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function info(Video $o)
|
|
|
|
{
|
2019-12-15 12:59:46 +00:00
|
|
|
return view('video.view',['o'=>$o]);
|
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
|
|
|
|
2019-12-15 12:59:46 +00:00
|
|
|
return redirect()->action('VideoController@info',[$o->id]);
|
2019-12-15 12:34:42 +00:00
|
|
|
}
|
2016-07-04 06:00:33 +00:00
|
|
|
|
2020-01-04 13:28:00 +00:00
|
|
|
public function view(Video $o)
|
2019-12-15 12:34:42 +00:00
|
|
|
{
|
2020-01-04 13:28:00 +00:00
|
|
|
if ($o->isReadable())
|
2020-01-05 07:02:32 +00:00
|
|
|
(new VideoStream($o->file_path()))->start();
|
2019-12-15 12:34:42 +00:00
|
|
|
}
|
|
|
|
}
|