Esempio n. 1
0
 /**
  * Remove all data of this Model from database.
  *
  * @access   public
  * @return   boolean
  * @since    2.1.2-dev
  * @version  2.1.2-dev
  */
 public function remove()
 {
     if ((int) $this->id === 1) {
         Route::factory('home')->redirectTo();
     }
     parent::remove();
 }
Esempio n. 2
0
 /**
  * Remove entity. If entity has been removed, delete related file.
  *
  * @access     public
  * @return    boolean
  * @since      1.0.0-alpha
  * @version    1.0.0-alpha
  */
 public function remove()
 {
     $bRemoved = parent::remove();
     if ($bRemoved) {
         // set path to file
         $sPath = $this->getPath() . DS . $this->getNameWithExt();
         // if it's an image, remove all its styles
         if (in_array($this->getExt(), ['jpg', 'jpeg', 'gif', 'png', 'tiff'])) {
             ImageStyles::removeStyledImgCache($sPath);
         }
         // remove file
         \FileManager::delete($sPath);
     }
     return $bRemoved;
 }
Esempio n. 3
0
 /**
  * Remove all data of this Model from database.
  *
  * @access     public
  * @return    boolean
  * @since      1.0.0-alpha
  * @version    1.0.0-alpha
  */
 public function remove()
 {
     $oFile = $this->file;
     /* @var $oFile File */
     parent::remove();
     $oFile->decreaseUses();
 }