src/Engine/Traits/FromModelTraitPart/StoreUpdateDeleteTrait.php
public function deleteById($id)
    {
        $model = $this->getById($id);

        if (empty($model))
            return $this;

        if ($this instanceof \JanDolata\CrudeCRUD\Engine\Interfaces\WithFileInterface) {
            $fileAttrName = $this->fileAttrName;
            $modelFiles = $model->$fileAttrName;

            foreach ($modelFiles as $file)
                $this->deleteFileByData($model->id, $file['file_log_id']);
        }

        $model->delete();

        if ($this->canOrder())
            $this->resetOrder();

        return $this;
    }
public function deleteById($id)
    {
        $model = $this->getById($id);

        if (empty($model))
            return $this;

        if ($this instanceof \JanDolata\CrudeCRUD\Engine\Interfaces\WithFileInterface) {
            $fileAttrName = $this->fileAttrName;
            $modelFiles = $model->$fileAttrName;

            foreach ($modelFiles as $file)
                $this->deleteFileByData($model->id, $file['file_log_id']);
        }

        $model->delete();

        if ($this->canOrder())
            $this->resetOrder();

        return $this;
    }
public function deleteById ( $ id ) { $ model = $ this -> getById ( $ id ) ; if ( empty ( $ model ) ) return $ this ; if ( $ this instanceof \ JanDolata \ CrudeCRUD \ Engine \ Interfaces \ WithFileInterface ) { $ fileAttrName = $ this -> fileAttrName ; $ modelFiles = $ model -> $ fileAttrName ; foreach ( $ modelFiles as $ file ) $ this -> deleteFileByData ( $ model -> id , $ file [ 'file_log_id' ] ) ; } $ model -> delete ( ) ; if ( $ this -> canOrder ( ) ) $ this -> resetOrder ( ) ; return $ this ; }
Delete by id
@param  integer $id
@return self
Delete by id