78 lines
1.5 KiB
PHP
78 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
use App\Models\Photo;
|
|
use App\Traits\Multimedia;
|
|
|
|
class PhotoController extends Controller
|
|
{
|
|
use Multimedia;
|
|
|
|
public function delete(Photo $o)
|
|
{
|
|
$o->remove = TRUE;
|
|
$o->save();
|
|
|
|
return redirect()
|
|
->back();
|
|
}
|
|
|
|
public function deletes(Request $request,$id=NULL)
|
|
{
|
|
return view('catalog.deletereview',[
|
|
'catalog'=>is_null($id)
|
|
? Photo::where('remove',1)
|
|
->with(['software.model.make'])
|
|
->orderBy('id')
|
|
->paginate($request->input('list',self::list_deletes))
|
|
: Photo::where('id',$id)
|
|
->paginate(1),
|
|
'return'=>url('p/deletes'),
|
|
'type'=>'photo',
|
|
]);
|
|
}
|
|
|
|
public function duplicates(Request $request,$id=NULL)
|
|
{
|
|
return view('catalog.duplicatereview',[
|
|
'catalog'=>is_null($id)
|
|
? Photo::duplicates()
|
|
->with(['software.model.make'])
|
|
->paginate($request->input('list',self::list_duplicates))
|
|
: Photo::where('id',$id)
|
|
->paginate(1),
|
|
'return'=>url('p/duplicates'),
|
|
'type'=>'photo',
|
|
]);
|
|
}
|
|
|
|
public function thumbnail(Photo $o)
|
|
{
|
|
return response($o->thumbnail())
|
|
->header('Content-Type','image/jpeg');
|
|
}
|
|
|
|
public function undelete(Photo $o)
|
|
{
|
|
$o->remove = NULL;
|
|
$o->save();
|
|
|
|
return redirect()
|
|
->back();
|
|
}
|
|
|
|
/**
|
|
* Render the photo to the browser
|
|
*
|
|
* @param Photo $o
|
|
* @return \Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Foundation\Application|\Illuminate\Http\Response
|
|
*/
|
|
public function view(Photo $o)
|
|
{
|
|
return response($o->image())
|
|
->header('Content-Type','image/jpeg');
|
|
}
|
|
} |