for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* @link https://github.com/roboapp
* @copyright Copyright (c) 2016 Roboapp
* @license [MIT License](https://opensource.org/licenses/MIT)
*/
namespace roboapp\crud;
* Action performs the hard or soft deleting of the existing record.
*
* @author iRipVanWinkle <[email protected]>
* @since 1.0
class Delete extends BaseAction
{
* Method name for hard delete model
const METHOD_HARD = 'delete';
* Method name for soft delete model
const METHOD_SOFT = 'softDelete';
* @var string method name for delete model.
public $methodName = self::METHOD_HARD;
* Deletes model
* @param mixed $id ID of the model to be deleted
* @return mixed
public function run($id)
$model = $this->getModel($id);
if ($model->{$this->methodName}()) {
$this->addSuccessFlash();
}
return $this->redirect($model);