2016-06-22 05:49:20 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
|
|
|
use Illuminate\Http\Response;
|
|
|
|
|
|
|
|
use App\Http\Requests;
|
|
|
|
use App\Model\Photo;
|
|
|
|
|
|
|
|
class PhotoController extends Controller
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Create a new controller instance.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
$this->middleware('guest');
|
|
|
|
}
|
|
|
|
|
2016-06-29 10:49:02 +00:00
|
|
|
public function delete($id)
|
|
|
|
{
|
|
|
|
$po = Photo::notRemove()->findOrFail($id);
|
|
|
|
|
|
|
|
if ($po)
|
|
|
|
{
|
|
|
|
$po->remove = TRUE;
|
|
|
|
$po->save();
|
|
|
|
}
|
|
|
|
|
|
|
|
return redirect()->action('PhotoController@info',[$id]);
|
|
|
|
}
|
|
|
|
|
2016-06-22 05:49:20 +00:00
|
|
|
public function info($id)
|
|
|
|
{
|
|
|
|
return view('photo.view', ['photo'=> Photo::findOrFail($id)]);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function thumbnail($id)
|
|
|
|
{
|
2016-06-29 10:49:02 +00:00
|
|
|
return response(Photo::findOrFail($id)->thumbnail(TRUE))->header('Content-Type','image/jpeg');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function undelete($id)
|
|
|
|
{
|
|
|
|
$po = Photo::findOrFail($id);
|
|
|
|
|
|
|
|
if ($po)
|
|
|
|
{
|
|
|
|
$po->remove = NULL;
|
|
|
|
$po->save();
|
|
|
|
}
|
|
|
|
|
|
|
|
return redirect()->action('PhotoController@info',[$id]);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function view($id)
|
|
|
|
{
|
|
|
|
return response(Photo::findOrFail($id)->image())->header('Content-Type','image/jpeg');
|
2016-06-22 05:49:20 +00:00
|
|
|
}
|
|
|
|
}
|