photo/app/Http/Controllers/VideoController.php

70 lines
1.4 KiB
PHP
Raw Normal View History

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;
use App\Helpers\VideoStream;
use App\Traits\Multimedia;
2016-07-04 06:00:33 +00:00
class VideoController extends Controller
{
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');
}
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()->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',[
'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',[
'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',
]);
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
public function view(Video $o)
2019-12-15 12:34:42 +00:00
{
if ($o->isReadable())
(new VideoStream($o->file_path()))->start();
2019-12-15 12:34:42 +00:00
}
}