Minor code cleanup
This commit is contained in:
parent
49933382f3
commit
c176ba9c94
@ -24,12 +24,12 @@ class PhotoController extends Controller
|
|||||||
|
|
||||||
public function delete($id)
|
public function delete($id)
|
||||||
{
|
{
|
||||||
$po = Photo::notRemove()->findOrFail($id);
|
$o = Photo::notRemove()->findOrFail($id);
|
||||||
|
|
||||||
if ($po)
|
if ($o)
|
||||||
{
|
{
|
||||||
$po->remove = TRUE;
|
$o->remove = TRUE;
|
||||||
$po->save();
|
$o->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect()->action('PhotoController@info',[$id]);
|
return redirect()->action('PhotoController@info',[$id]);
|
||||||
@ -68,18 +68,18 @@ class PhotoController extends Controller
|
|||||||
{
|
{
|
||||||
foreach ($request->input('items') as $id)
|
foreach ($request->input('items') as $id)
|
||||||
{
|
{
|
||||||
$po = Photo::findOrFail($id);
|
$o = Photo::findOrFail($id);
|
||||||
|
|
||||||
// Set if duplicate
|
// Set if duplicate
|
||||||
$po->duplicate = $request->input('duplicate.'.$id) ? 1 : NULL;
|
$o->duplicate = $request->input('duplicate.'.$id) ? 1 : NULL;
|
||||||
|
|
||||||
// Set if flag
|
// Set if flag
|
||||||
$po->flag = $request->input('flag.'.$id) ? 1 : NULL;
|
$o->flag = $request->input('flag.'.$id) ? 1 : NULL;
|
||||||
|
|
||||||
// Set if delete
|
// 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'));
|
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');
|
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)
|
return redirect()->action('PhotoController@info',[$o->id]);
|
||||||
{
|
|
||||||
$po->remove = NULL;
|
|
||||||
$po->save();
|
|
||||||
}
|
|
||||||
|
|
||||||
return redirect()->action('PhotoController@info',[$id]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function view($id)
|
public function view($id)
|
||||||
|
@ -22,12 +22,12 @@ class VideoController extends Controller
|
|||||||
|
|
||||||
public function delete($id)
|
public function delete($id)
|
||||||
{
|
{
|
||||||
$po = Video::notRemove()->findOrFail($id);
|
$o = Video::notRemove()->findOrFail($id);
|
||||||
|
|
||||||
if ($po)
|
if ($o)
|
||||||
{
|
{
|
||||||
$po->remove = TRUE;
|
$o->remove = TRUE;
|
||||||
$po->save();
|
$o->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect()->action('VideoController@info',[$id]);
|
return redirect()->action('VideoController@info',[$id]);
|
||||||
@ -35,16 +35,19 @@ class VideoController extends Controller
|
|||||||
|
|
||||||
public function deletes($id=NULL)
|
public function deletes($id=NULL)
|
||||||
{
|
{
|
||||||
return view('catalog.deletereview',['return'=>url('v/deletes'),'catalog'=>is_null($id) ? Video::where('remove',1)->paginate(50) : Video::where('id',$id)->paginate(1)]);
|
return view('catalog.deletereview',[
|
||||||
|
'return'=>url('v/deletes'),
|
||||||
|
'catalog'=>is_null($id) ? Video::where('remove',1)->paginate(50) : Video::where('id',$id)->paginate(1)
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deletesUpdate(Request $request)
|
public function deletesUpdate(Request $request)
|
||||||
{
|
{
|
||||||
foreach ($request->input('remove') as $k=>$id)
|
foreach ($request->input('remove') as $id=>$k)
|
||||||
{
|
{
|
||||||
$o = Video::findOrFail($k);
|
$o = Video::findOrFail($id);
|
||||||
|
|
||||||
if ($o->remove AND $request->input('remove.'.$k))
|
if ($o->remove AND $request->input('remove.'.$id))
|
||||||
$this->dispatch((new VideoDelete($o))->onQueue('delete'));
|
$this->dispatch((new VideoDelete($o))->onQueue('delete'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,25 +56,27 @@ class VideoController extends Controller
|
|||||||
|
|
||||||
public function duplicates($id=NULL)
|
public function duplicates($id=NULL)
|
||||||
{
|
{
|
||||||
return view('catalog.duplicatereview',['return'=>url('/v/duplicates'),'catalog'=>is_null($id) ? Video::notRemove()->where('duplicate',1)->paginate(50) : Video::where('id',$id)->paginate(1)]);
|
return view('catalog.duplicatereview',[
|
||||||
|
'return'=>url('v/duplicates'),
|
||||||
|
'catalog'=>is_null($id) ? Video::notRemove()->where('duplicate',1)->paginate(50) : Video::where('id',$id)->paginate(1)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function duplicatesUpdate(Request $request)
|
public function duplicatesUpdate(Request $request)
|
||||||
{
|
{
|
||||||
foreach ($request->input('items') as $id)
|
foreach ($request->input('items') as $id)
|
||||||
{
|
{
|
||||||
$po = Video::findOrFail($id);
|
$o = Video::findOrFail($id);
|
||||||
|
|
||||||
// Set if duplicate
|
// Set if duplicate
|
||||||
$po->duplicate = $request->input('duplicate.'.$id) ? 1 : NULL;
|
$o->duplicate = $request->input('duplicate.'.$id) ? 1 : NULL;
|
||||||
|
|
||||||
// Set if flag
|
// Set if flag
|
||||||
$po->flag = $request->input('flag.'.$id) ? 1 : NULL;
|
$o->flag = $request->input('flag.'.$id) ? 1 : NULL;
|
||||||
|
|
||||||
// Set if delete
|
// Set if delete
|
||||||
$po->remove = $request->input('remove.'.$id) ? 1 : NULL;
|
$o->remove = $request->input('remove.'.$id) ? 1 : NULL;
|
||||||
|
|
||||||
$po->isDirty() AND $po->save();
|
$o->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect()->action('VideoController@duplicates','?page='.$request->input('page'));
|
return redirect()->action('VideoController@duplicates','?page='.$request->input('page'));
|
||||||
@ -79,20 +84,15 @@ class VideoController extends Controller
|
|||||||
|
|
||||||
public function info(Video $o)
|
public function info(Video $o)
|
||||||
{
|
{
|
||||||
return view('video.view', ['o'=>$o]);
|
return view('video.view',['o'=>$o]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function undelete($id)
|
public function undelete(Video $o)
|
||||||
{
|
{
|
||||||
$po = Video::findOrFail($id);
|
$o->remove = NULL;
|
||||||
|
$o->save();
|
||||||
|
|
||||||
if ($po)
|
return redirect()->action('VideoController@info',[$o->id]);
|
||||||
{
|
|
||||||
$po->remove = NULL;
|
|
||||||
$po->save();
|
|
||||||
}
|
|
||||||
|
|
||||||
return redirect()->action('VideoController@info',[$id]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function view($id)
|
public function view($id)
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="{{ url('p/deletes') }}" class="nav-link @if(preg_match('#^p/deletes$/'.'#',request()->path())) active @endif">
|
<a href="{{ url('p/deletes') }}" class="nav-link @if(preg_match('#^p/deletes$#',request()->path())) active @endif">
|
||||||
<i class="fa fa-calendar nav-icon"></i> <p>Delete</p>
|
<i class="fa fa-calendar nav-icon"></i> <p>Delete</p>
|
||||||
<span class="badge badge-danger right">{{ \App\Models\Photo::where('remove',TRUE)->count() }}</span>
|
<span class="badge badge-danger right">{{ \App\Models\Photo::where('remove',TRUE)->count() }}</span>
|
||||||
</a>
|
</a>
|
||||||
@ -42,7 +42,7 @@
|
|||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="{{ url('v/deletes') }}" class="nav-link @if(preg_match('#^v/deletes$/'.'#',request()->path())) active @endif">
|
<a href="{{ url('v/deletes') }}" class="nav-link @if(preg_match('#^v/deletes$#',request()->path())) active @endif">
|
||||||
<i class="fa fa-calendar nav-icon"></i> <p>Delete</p>
|
<i class="fa fa-calendar nav-icon"></i> <p>Delete</p>
|
||||||
<span class="badge badge-danger right">{{ \App\Models\Video::where('remove',TRUE)->count() }}</span>
|
<span class="badge badge-danger right">{{ \App\Models\Video::where('remove',TRUE)->count() }}</span>
|
||||||
</a>
|
</a>
|
||||||
|
Loading…
Reference in New Issue
Block a user