예제 #1
0
 /**
  * Mass delete function from index page
  * @param Request $request
  *
  * @return mixed
  */
 public function massDelete(Request $request)
 {
     if ($request->get('toDelete') != 'mass') {
         $toDelete = json_decode($request->get('toDelete'));
         Pages::destroy($toDelete);
     } else {
         Pages::whereNotNull('id')->delete();
     }
     return redirect()->route('admin.pages.index');
 }
예제 #2
0
 /**
  * Remove the specified resource from storage.
  *
  * @param int $id
  * @return Response
  */
 public function destroy($id)
 {
     $more = Pages::where('pages_id', $id)->get();
     if (count($more) > 0) {
         return redirect('admin/pages')->with('info', 'Nie można usunąc kategorii do której są przypisane inne strony.');
     } else {
         Pages::destroy($id);
     }
     return redirect('admin/pages')->with('status', 'Wpis został pomyślnie usunięty');
 }