Corcel\Post::save PHP 메소드

save() 공개 메소드

public save ( array $options = [] )
$options array
    public function save(array $options = [])
    {
        if (isset($this->attributes[$this->primaryKey])) {
            $this->meta->save($this->attributes[$this->primaryKey]);
        }
        return parent::save($options);
    }

Usage Example

예제 #1
0
파일: PostTest.php 프로젝트: akwatra/corcel
 public function testInsertCustomFields()
 {
     $post = new Post();
     $post->save();
     $post->meta->username = '******';
     $post->meta->url = 'http://grossi.io';
     $post->save();
     $post = Post::find($post->ID);
     $this->assertEquals($post->meta->username, 'juniorgrossi');
     $this->assertEquals($post->meta->url, 'http://grossi.io');
 }