Added delete and removed Kohana
This commit is contained in:
@@ -7,6 +7,7 @@ use Illuminate\Http\Request;
|
||||
|
||||
use App\Http\Requests;
|
||||
use App\Model\Photo;
|
||||
use App\Jobs\PhotoDelete;
|
||||
|
||||
class PhotoController extends Controller
|
||||
{
|
||||
@@ -33,9 +34,27 @@ class PhotoController extends Controller
|
||||
return redirect()->action('PhotoController@info',[$id]);
|
||||
}
|
||||
|
||||
public function deletes()
|
||||
{
|
||||
return view('photo.deletereview',['photos'=>Photo::where('remove',1)->paginate(2)]);
|
||||
}
|
||||
|
||||
public function deletesUpdate(Request $request)
|
||||
{
|
||||
foreach ($request->input('photo') as $id)
|
||||
{
|
||||
$photo = Photo::findOrFail($id);
|
||||
|
||||
if ($photo->remove AND $request->input('remove.'.$id))
|
||||
$this->dispatch((new PhotoDelete($photo))->onQueue('delete'));
|
||||
}
|
||||
|
||||
return $request->input('pagenext') ? redirect()->action('PhotoController@deletes','?page='.$request->input('pagenext')) : redirect('/');
|
||||
}
|
||||
|
||||
public function duplicates($id=NULL)
|
||||
{
|
||||
return view('photo.duplicates', ['photos'=> Photo::notRemove()->where('duplicate',1)->paginate(1)]);
|
||||
return view('photo.duplicates',['photos'=>is_null($id) ? Photo::notRemove()->where('duplicate',1)->paginate(1) : Photo::where('id',$id)->paginate(1)]);
|
||||
}
|
||||
|
||||
public function duplicatesUpdate(Request $request)
|
||||
|
@@ -19,10 +19,12 @@ Route::get('/', function () {
|
||||
|
||||
Route::auth();
|
||||
|
||||
Route::get('/deletes/{id?}', 'PhotoController@deletes')->where('id', '[0-9]+');;
|
||||
Route::get('/duplicates/{id?}', 'PhotoController@duplicates')->where('id', '[0-9]+');;
|
||||
Route::get('/info/{id}', 'PhotoController@info')->where('id', '[0-9]+');;
|
||||
Route::get('/thumbnail/{id}', 'PhotoController@thumbnail')->where('id', '[0-9]+');;
|
||||
Route::get('/view/{id}', 'PhotoController@view')->where('id', '[0-9]+');;
|
||||
Route::post('/delete/{id}', 'PhotoController@delete')->where('id', '[0-9]+');;
|
||||
Route::post('/duplicates', 'PhotoController@duplicatesUpdate')->where('id', '[0-9]+');;
|
||||
Route::post('/duplicates', 'PhotoController@duplicatesUpdate');
|
||||
Route::post('/deletes', 'PhotoController@deletesUpdate');
|
||||
Route::post('/undelete/{id}', 'PhotoController@undelete')->where('id', '[0-9]+');;
|
||||
|
Reference in New Issue
Block a user