75 lines
1.5 KiB
PHP
75 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
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()
|
|
->action('PhotoController@info',[$o->id]);
|
|
}
|
|
|
|
public function deletes($id=NULL)
|
|
{
|
|
return view('catalog.deletereview',[
|
|
'catalog'=>is_null($id)
|
|
? Photo::where('remove',1)
|
|
->with(['software.model.make'])
|
|
->paginate(self::list_deletes)
|
|
: Photo::where('id',$id)
|
|
->paginate(1),
|
|
'return'=>url('p/deletes'),
|
|
'type'=>'photo',
|
|
]);
|
|
}
|
|
|
|
public function duplicates($id=NULL)
|
|
{
|
|
return view('catalog.duplicatereview',[
|
|
'catalog'=>is_null($id)
|
|
? Photo::duplicates()
|
|
->with(['software.model.make'])
|
|
->paginate(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()
|
|
->action('PhotoController@info',[$o->id]);
|
|
}
|
|
|
|
/**
|
|
* 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');
|
|
}
|
|
} |