Normally, when we want delete a record in Database, we always check some strict condition before delete it. In a basic PHP, the process of checking condition is very hard and complex. Furthermore, we cannot reuse this process code on other page with the same database.The only way to do this is copy again the code and paste it in new page.
But in yii, everything will be changed. We easily make delete with condition and reuse it every time we want. The key is beforeDelete() function.

In model class create new function name beforeDelete() with some condition we want, like my example.

public function beforeDelete(){
    if($this->is_required=='no'){
        return true;
    }
    return false;
}

Go back to actionDelete in controller and do it like normal.

public function actionDelete($id){
    if($this->request->isPostRequest){ //enforce use of POST
        $model=$this->loadModel($id); // loadModel throws an exception if the record doesn't exist
        if($model->delete()){
            // do your redirects here
        }else{
            // do something else
        }
    }else{
        throw new CHttpException(400,'Invalid Request');
    }
}

So, whenever a delete action happens. It will check the $model->is_required whether is no or not. If it returns a yes message, the delete action will be forced to stop.