2016-07-04 06:00:33 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
2024-10-01 01:44:26 +00:00
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
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
|
|
|
|
2024-09-30 12:56:08 +00:00
|
|
|
return redirect()
|
2024-10-04 04:39:56 +00:00
|
|
|
->back();
|
2019-12-15 12:34:42 +00:00
|
|
|
}
|
2016-07-04 06:00:33 +00:00
|
|
|
|
2024-10-01 01:44:26 +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',[
|
2024-09-30 12:56:08 +00:00
|
|
|
'catalog'=>is_null($id)
|
|
|
|
? Video::where('remove',1)
|
|
|
|
->with(['software.model.make'])
|
2024-10-01 01:44:26 +00:00
|
|
|
->paginate($request->input('list',self::list_deletes))
|
2024-09-30 12:56:08 +00:00
|
|
|
: 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
|
|
|
|
2024-10-01 01:44:26 +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',[
|
2024-09-30 12:56:08 +00:00
|
|
|
'catalog'=>is_null($id)
|
|
|
|
? Video::duplicates()
|
|
|
|
->with(['software.model.make'])
|
2024-10-01 01:44:26 +00:00
|
|
|
->paginate($request->input('list',self::list_duplicates))
|
2024-09-30 12:56:08 +00:00
|
|
|
: 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
|
|
|
}
|
|
|
|
|
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
|
|
|
|
2024-09-30 12:56:08 +00:00
|
|
|
return redirect()
|
2024-10-04 04:39:56 +00:00
|
|
|
->back();
|
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())
|
2024-09-16 13:18:51 +00:00
|
|
|
(new VideoStream($o->file_name(FALSE)))
|
|
|
|
->start();
|
2019-12-15 12:34:42 +00:00
|
|
|
}
|
|
|
|
}
|