Ejemplo n.º 1
0
 public function post_terms()
 {
     $input = Input::all();
     if ($input['submit'] == 'save') {
         if ($input['id'] > 0) {
             $terms = Term::find($input['id']);
             $terms->update($input);
         } else {
             $terms = new Term();
             $terms->create($input);
         }
     } else {
         if ($input['id'] > 0) {
             Term::destroy($input['id']);
         }
     }
     return redirect('terms')->with('message', 'Terms have been updated successfully');
 }
Ejemplo n.º 2
0
 /**
  * Delete the given Term.
  *
  * @param  int      $id
  * @return Redirect
  */
 public function getDelete($id = null)
 {
     $term = Term::destroy($id);
     // Redirect to the group management page
     return redirect('admin/terms')->with('success', Lang::get('message.success.delete'));
 }
Ejemplo n.º 3
0
 /**
  * Remove the specified resource from storage.
  *
  * @param Request $request
  * @param  int    $id
  *
  * @return \Illuminate\Http\Response
  */
 public function destroy(Request $request, $id)
 {
     $success = Term::destroy($id);
     if (!$success && !$request->ajax()) {
         return redirect()->route('term.index')->with('errors', 'Term could not be deleted!');
     }
     Event::fire(new TermDeleted($id));
     if ($request->ajax()) {
         return compact('success', 'id');
     }
     return redirect()->route('terms')->with('success', 'Term deleted!');
 }