Welcome Guest, Not a member yet? Register   Sign In
orderBy() function is not working when delete() function is used in query builder.
#2

when you delete some data you dont need sort or order 
PHP Code:
/**
     * edit function
     * @method : DELETE with params ID
     */
    public function delete($id null)
    {


        $contactFileModel = new ContactMediaModal();
        $handy = new CustomFileSystem();
        $id = ($id == $id);

        if ($id == 0) {

            $isExist $contactFileModel->where(['contact_id' => $this->request->getGet('foreignKey')])->findAll();
            $target = array('contact_id' => $this->request->getGet('foreignKey'));
        } else {
            $isExist $contactFileModel->where(['id' => $id])->findAll();
            $target = array('id' => $id);
        }


        if ($isExist) {
            $contactFileModel->where($target)->delete();
            foreach ($isExist as $path) {

                $handy->removeSingleFile(ROOTPATH $path->path);
            }


        }

        return $this->respond([
        ], ResponseInterface::HTTP_OK,  lang('Common.api.remove'));

    
Enlightenment  Is  Freedom
Reply


Messages In This Thread
RE: orderBy() function is not working when delete() function is used in query builder. - by paliz - 05-25-2021, 12:41 PM



Theme © iAndrew 2016 - Forum software by © MyBB