public function deleteTask()
	{
		// Require authenitcation
		$this->requiresAuthentication();

		$model = $this->resolveModel();

		// Load record
		$model = $model
			->whereEquals($model->getPrimaryKey(), Request::getVar($model->getPrimaryKey()))
			->row();

		if ($model->isNew())
		{
			App::abort(404, Lang::txt('JLIB_APPLICATION_ERROR_ITEM_NOT_FOUND'));
		}

		if (!$model->destroy())
		{
			App::abort(500, Lang::txt('JLIB_APPLICATION_ERROR_DELETE_FAILED', $model->getError()));
		}

		// Log activity
		$recipients = array();

		if ($model->hasAttribute('created_by'))
		{
			$recipients[] = $model->get('created_by');
		}
		if ($model->hasAttribute('modified_by'))
		{
			$recipients[] = $model->get('modified_by');
		}

		Event::trigger('system.logActivity', [
			'activity' => [
				'action'      => 'deleted',
				'scope'       => $this->_name . '.' . $model->getModelName(),
				'scope_id'    => $model->get($model->getPrimaryKey()),
				'description' => Lang::txt(
					'JLIB_ACTIVITY_ITEM_DELETED',
					$model->getModelName() . ' #' . $model->get($model->getPrimaryKey())
				),
				'details'     => $model->toArray()
			],
			'recipients' => $recipients
		]);

		// Send status
		$this->send(null, 204);
	}
public function deleteTask()
	{
		// Require authenitcation
		$this->requiresAuthentication();

		$model = $this->resolveModel();

		// Load record
		$model = $model
			->whereEquals($model->getPrimaryKey(), Request::getVar($model->getPrimaryKey()))
			->row();

		if ($model->isNew())
		{
			App::abort(404, Lang::txt('JLIB_APPLICATION_ERROR_ITEM_NOT_FOUND'));
		}

		if (!$model->destroy())
		{
			App::abort(500, Lang::txt('JLIB_APPLICATION_ERROR_DELETE_FAILED', $model->getError()));
		}

		// Log activity
		$recipients = array();

		if ($model->hasAttribute('created_by'))
		{
			$recipients[] = $model->get('created_by');
		}
		if ($model->hasAttribute('modified_by'))
		{
			$recipients[] = $model->get('modified_by');
		}

		Event::trigger('system.logActivity', [
			'activity' => [
				'action'      => 'deleted',
				'scope'       => $this->_name . '.' . $model->getModelName(),
				'scope_id'    => $model->get($model->getPrimaryKey()),
				'description' => Lang::txt(
					'JLIB_ACTIVITY_ITEM_DELETED',
					$model->getModelName() . ' #' . $model->get($model->getPrimaryKey())
				),
				'details'     => $model->toArray()
			],
			'recipients' => $recipients
		]);

		// Send status
		$this->send(null, 204);
	}
public function deleteTask ( ) { // Require authenitcation $ this -> requiresAuthentication ( ) ; $ model = $ this -> resolveModel ( ) ; // Load record $ model = $ model -> whereEquals ( $ model -> getPrimaryKey ( ) , Request :: getVar ( $ model -> getPrimaryKey ( ) ) ) -> row ( ) ; if ( $ model -> isNew ( ) ) { App :: abort ( 404 , Lang :: txt ( 'JLIB_APPLICATION_ERROR_ITEM_NOT_FOUND' ) ) ; } if ( ! $ model -> destroy ( ) ) { App :: abort ( 500 , Lang :: txt ( 'JLIB_APPLICATION_ERROR_DELETE_FAILED' , $ model -> getError ( ) ) ) ; } // Log activity $ recipients = array ( ) ; if ( $ model -> hasAttribute ( 'created_by' ) ) { $ recipients [ ] = $ model -> get ( 'created_by' ) ; } if ( $ model -> hasAttribute ( 'modified_by' ) ) { $ recipients [ ] = $ model -> get ( 'modified_by' ) ; } Event :: trigger ( 'system.logActivity' , [ 'activity' => [ 'action' => 'deleted' , 'scope' => $ this -> _name . '.' . $ model -> getModelName ( ) , 'scope_id' => $ model -> get ( $ model -> getPrimaryKey ( ) ) , 'description' => Lang :: txt ( 'JLIB_ACTIVITY_ITEM_DELETED' , $ model -> getModelName ( ) . ' #' . $ model -> get ( $ model -> getPrimaryKey ( ) ) ) , 'details' => $ model -> toArray ( ) ] , 'recipients' => $ recipients ] ) ; // Send status $ this -> send ( null , 204 ) ; }
Delete an entry

@apiMethod DELETE
@apiUri    /{component}/{controller}/{primary key}
@return    void
Delete an entry