The task for the 'Delete' action is: helloworlds.delete
Joomla will look in the subcontroller file: admin/controllers/helloworlds.php
The delete() method is defined in the class JControllerAdmin, so you are not required to define it again. Extend the Controller class with JControllerAdmin.
This method gets the ids from the post request. Then, it gets the model and on that model, define a function delete() and pass the ids. Then, it sets up a message for successful deletion and finally set the redirect to the list of items.
In the model, the delete() gets the table and delete the records with ids. Publish and Unpublish actions are similar.
Step 1: Subcontroller File
The subcontroller helloworlds uses helloworld model because we need the functionality of JModelAdmin (used by helloworld model) and not the functionality of JModelList (used by helloworlds model). So, first you need to get this model.
class HelloWorldControllerHelloWorlds extends JControllerAdmin
public function getModel($name = 'HelloWorld', $prefix = 'HelloWorldModel', $config = array('ignore_request' => true))
$model = parent::getModel($name, $prefix, $config);
Step 2: Model File
Extend the Model class with JModelAdmin in the file: admin/models/helloworld.php
Here, you need to get the table.
class HelloWorldModelHelloWorld extends JModelAdmin
public function getTable($type = 'HelloWorld', $prefix = 'HelloWorldTable', $config = array())
return JTable::getInstance($type, $prefix, $config);