Minor code cleanup

This commit is contained in:
Deon George
2019-12-15 23:59:46 +11:00
parent 49933382f3
commit c176ba9c94
3 changed files with 54 additions and 59 deletions

View File

@@ -24,12 +24,12 @@ class PhotoController extends Controller
public function delete($id)
{
$po = Photo::notRemove()->findOrFail($id);
$o = Photo::notRemove()->findOrFail($id);
if ($po)
if ($o)
{
$po->remove = TRUE;
$po->save();
$o->remove = TRUE;
$o->save();
}
return redirect()->action('PhotoController@info',[$id]);
@@ -68,18 +68,18 @@ class PhotoController extends Controller
{
foreach ($request->input('items') as $id)
{
$po = Photo::findOrFail($id);
$o = Photo::findOrFail($id);
// Set if duplicate
$po->duplicate = $request->input('duplicate.'.$id) ? 1 : NULL;
$o->duplicate = $request->input('duplicate.'.$id) ? 1 : NULL;
// Set if flag
$po->flag = $request->input('flag.'.$id) ? 1 : NULL;
$o->flag = $request->input('flag.'.$id) ? 1 : NULL;
// Set if delete
$po->remove = $request->input('remove.'.$id) ? 1 : NULL;
$o->remove = $request->input('remove.'.$id) ? 1 : NULL;
$po->save();
$o->save();
}
return redirect()->action('PhotoController@duplicates','?page='.$request->input('page'));
@@ -95,17 +95,12 @@ class PhotoController extends Controller
return response(Photo::findOrFail($id)->thumbnail(TRUE))->header('Content-Type','image/jpeg');
}
public function undelete($id)
public function undelete(Photo $o)
{
$po = Photo::findOrFail($id);
$o->remove = NULL;
$o->save();
if ($po)
{
$po->remove = NULL;
$po->save();
}
return redirect()->action('PhotoController@info',[$id]);
return redirect()->action('PhotoController@info',[$o->id]);
}
public function view($id)