original_string: public function index_onDelete()
      {
          if (method_exists($this->controller, 'onDelete')) {
              return call_user_func_array([$this->controller, 'onDelete'], func_get_args());
          }
  
          /*
           * Validate checked identifiers
           */
          $checkedIds = post('checked');
  
          if (!$checkedIds || !is_array($checkedIds) || !count($checkedIds)) {
              Flash::error(Lang::get('backend::lang.list.delete_selected_empty'));
              return $this->controller->listRefresh();
          }
  
          /*
           * Establish the list definition
           */
          $definition = post('definition', $this->primaryDefinition);
  
          if (!isset($this->listDefinitions[$definition])) {
              throw new ApplicationException(Lang::get('backend::lang.list.missing_parent_definition', compact('definition')));
          }
  
          $listConfig = $this->controller->listGetConfig($definition);
  
          /*
           * Create the model
           */
          $class = $listConfig->modelClass;
          $model = new $class;
          $model = $this->controller->listExtendModel($model, $definition);
  
          /*
           * Create the query
           */
          $query = $model->newQuery();
          $this->controller->listExtendQueryBefore($query, $definition);
  
          $query->whereIn($model->getKeyName(), $checkedIds);
          $this->controller->listExtendQuery($query, $definition);
  
          /*
           * Delete records
           */
          $records = $query->get();
  
          if ($records->count()) {
              foreach ($records as $record) {
                  $record->delete();
              }
  
              Flash::success(Lang::get('backend::lang.list.delete_selected_success'));
          }
          else {
              Flash::error(Lang::get('backend::lang.list.delete_selected_empty'));
          }
  
          return $this->controller->listRefresh($definition);
      }
code: public function index_onDelete()
      {
          if (method_exists($this->controller, 'onDelete')) {
              return call_user_func_array([$this->controller, 'onDelete'], func_get_args());
          }
  
          /*
           * Validate checked identifiers
           */
          $checkedIds = post('checked');
  
          if (!$checkedIds || !is_array($checkedIds) || !count($checkedIds)) {
              Flash::error(Lang::get('backend::lang.list.delete_selected_empty'));
              return $this->controller->listRefresh();
          }
  
          /*
           * Establish the list definition
           */
          $definition = post('definition', $this->primaryDefinition);
  
          if (!isset($this->listDefinitions[$definition])) {
              throw new ApplicationException(Lang::get('backend::lang.list.missing_parent_definition', compact('definition')));
          }
  
          $listConfig = $this->controller->listGetConfig($definition);
  
          /*
           * Create the model
           */
          $class = $listConfig->modelClass;
          $model = new $class;
          $model = $this->controller->listExtendModel($model, $definition);
  
          /*
           * Create the query
           */
          $query = $model->newQuery();
          $this->controller->listExtendQueryBefore($query, $definition);
  
          $query->whereIn($model->getKeyName(), $checkedIds);
          $this->controller->listExtendQuery($query, $definition);
  
          /*
           * Delete records
           */
          $records = $query->get();
  
          if ($records->count()) {
              foreach ($records as $record) {
                  $record->delete();
              }
  
              Flash::success(Lang::get('backend::lang.list.delete_selected_success'));
          }
          else {
              Flash::error(Lang::get('backend::lang.list.delete_selected_empty'));
          }
  
          return $this->controller->listRefresh($definition);
      }
code_tokens: public function index_onDelete ( ) { if ( method_exists ( $ this -> controller , 'onDelete' ) ) { return call_user_func_array ( [ $ this -> controller , 'onDelete' ] , func_get_args ( ) ) ; } /*
           * Validate checked identifiers
           */ $ checkedIds = post ( 'checked' ) ; if ( ! $ checkedIds || ! is_array ( $ checkedIds ) || ! count ( $ checkedIds ) ) { Flash :: error ( Lang :: get ( 'backend::lang.list.delete_selected_empty' ) ) ; return $ this -> controller -> listRefresh ( ) ; } /*
           * Establish the list definition
           */ $ definition = post ( 'definition' , $ this -> primaryDefinition ) ; if ( ! isset ( $ this -> listDefinitions [ $ definition ] ) ) { throw new ApplicationException ( Lang :: get ( 'backend::lang.list.missing_parent_definition' , compact ( 'definition' ) ) ) ; } $ listConfig = $ this -> controller -> listGetConfig ( $ definition ) ; /*
           * Create the model
           */ $ class = $ listConfig -> modelClass ; $ model = new $ class ; $ model = $ this -> controller -> listExtendModel ( $ model , $ definition ) ; /*
           * Create the query
           */ $ query = $ model -> newQuery ( ) ; $ this -> controller -> listExtendQueryBefore ( $ query , $ definition ) ; $ query -> whereIn ( $ model -> getKeyName ( ) , $ checkedIds ) ; $ this -> controller -> listExtendQuery ( $ query , $ definition ) ; /*
           * Delete records
           */ $ records = $ query -> get ( ) ; if ( $ records -> count ( ) ) { foreach ( $ records as $ record ) { $ record -> delete ( ) ; } Flash :: success ( Lang :: get ( 'backend::lang.list.delete_selected_success' ) ) ; } else { Flash :: error ( Lang :: get ( 'backend::lang.list.delete_selected_empty' ) ) ; } return $ this -> controller -> listRefresh ( $ definition ) ; }
docstring: Bulk delete records.
  @return void
docstring_tokens: Bulk delete records .