Exemple #1
0
 public function __get($format)
 {
     if (in_array($format, TimeHelper::$formats)) {
         return TimeHelper::to_string($format, $this->time);
     }
     if (in_array($format, DateHelper::$formats)) {
         return DateHelper::to_string($format, $this->time);
     }
 }
 public function up()
 {
     $table = $this->alter_table('users');
     $table->timestamp('channel_updated');
     $table->go();
     foreach (User::find_all() as $user) {
         $user->channel_updated = DateHelper::to_string('db', time());
         $user->save();
     }
 }
 private static function update_timestamps(array $timestamp_cols, array $attributes)
 {
     $columns = self::columns();
     $time = DateHelper::to_string('db', time());
     foreach ($timestamp_cols as $ts) {
         if (in_array($ts, $columns)) {
             $attributes = array_merge($attributes, array($ts => $time));
         }
     }
     return $attributes;
 }