Ejemplo n.º 1
0
 /**
  * @param string $name
  * @return array
  */
 public function execute($name = '')
 {
     $file = $this->generatePath($name);
     if ($this->file->exists($file)) {
         if (is_readable($file)) {
             $content = $this->file->read($file);
             $content = json_decode($content, true);
             foreach ($content as $arg) {
                 $createTable = $arg['createTable'];
                 $params = $arg['params'];
                 $content = $arg['content'];
                 $table = $arg['table'];
                 // query i çalıştırıyoruz
                 if ($this->firstStepQueryContent($content)) {
                     // tablo yapısını oluşturuyoruz
                     if ($this->againCreateTableQuery($createTable)) {
                         $insert = $this->base->insert($table, function (Insert $mode) use($params) {
                             return $mode->set($params)->run();
                         });
                         if ($insert) {
                             return true;
                         }
                     }
                 }
             }
         }
     }
     return false;
 }
 /**
  * Write session data
  * @link http://php.net/manual/en/sessionhandlerinterface.write.php
  * @param string $session_id The session id.
  * @param string $session_data <p>
  * The encoded session data. This data is the
  * result of the PHP internally encoding
  * the $_SESSION superglobal to a serialized
  * string and passing it as this parameter.
  * Please note sessions use an alternative serialization method.
  * </p>
  * @return bool <p>
  * The return value (usually TRUE on success, FALSE on failure).
  * Note this value is returned internally to PHP for processing.
  * </p>
  * @since 5.4.0
  */
 public function write($session_id, $session_data)
 {
     $count = $this->database->read($this->table, function (Read $read) use($session_id) {
         return $read->where([['key', '=', $session_id]])->build();
     });
     if (!$count->rowCount()) {
         $return = $this->database->insert($this->table, function (Insert $insert) use($session_id, $session_data) {
             return $insert->set(['key' => $session_id, 'value' => $session_data])->build()->run();
         });
     } else {
         $return = $this->database->update($this->table, function (Update $update) use($session_id, $session_data) {
             return $update->where([['key', '=', $session_id]])->set(['value' => $session_data])->run();
         });
     }
     return $return ? true : false;
 }
Ejemplo n.º 3
0
 /**
  * Veritabanndan veri silme işlemi yapar
  *
  * @return mixed
  */
 public function delete()
 {
     $app = $this;
     return $this->db->delete($this->table, function (Delete $mode) use($app) {
         if (isset($app->where)) {
             $mode->where($app->where);
         }
         return $mode->run();
     });
 }
Ejemplo n.º 4
0
 /**
  * Sınıfı başlatır
  *
  */
 public function __construct(Base $base)
 {
     static::setConnection($base->getConnection());
 }
 /**
  *
  * Uygulamayı alır ve toplamaya başlar
  *
  * @param Base $base
  */
 public function __construct(Base $base)
 {
     $this->base = $base;
     Schema::setConnection($this->base->getConnection());
 }