Ejemplo n.º 1
0
 /**
  * Checking that Table and Config exists and throw exceptions if not
  * @return boolean
  * @throws LazerException
  */
 public function exists()
 {
     if (!Data::table($this->name)->exists()) {
         return false;
     }
     if (!Config::table($this->name)->exists()) {
         throw new LazerException('Config "' . $this->name . '" does not exists');
     }
     return true;
 }
Ejemplo n.º 2
0
 /**
  * Deleting loaded data
  * @return boolean
  */
 public function delete()
 {
     $data = $this->getData();
     if (isset($this->currentId)) {
         unset($data[$this->currentKey]);
     } else {
         $this->pending();
         $old = $data;
         $data = array_diff_key($old, $this->data);
     }
     $this->data = array_values($data);
     return Helpers\Data::table($this->name)->put($this->data) ? true : false;
 }