Example #1
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($tag_id, $role_id, $action_id)
 {
     $action = Action::find($action_id);
     if ($action != null) {
         $users = Knock::deleteAction($action_id);
         $msg = 'Action [' . $action->name . '] has been deleted. ';
         if ($users->isEmpty()) {
             $msg .= ' No users are affected by this deletion.';
         } else {
             $msg .= ' The permission to perform this action has been removed from the following users: ' . $users->pluck('email')->implode(', ');
         }
         return redirect('/knock/tags/' . $action->role->tag->id . '/roles/' . $action->role->id)->with('flash_message', $msg);
     }
 }
Example #2
0
 /**
  * 
  * @param String $action_id ID of action to delete
  */
 public function deleteAction($action_id)
 {
     $action = Action::findOrFail($action_id);
     $users = $action->removeAllUsages();
     if (!$action == null) {
         $action->delete();
     }
     return $users;
 }