コード例 #1
0
 public function testGettingNewCollection()
 {
     $model = new TranslationModel();
     $collection = $model->newCollection([1, 2]);
     $this->assertInstanceOf(SimpleTranslationCollection::class, $collection);
     $this->assertSame(2, $collection->count());
 }
コード例 #2
0
 /**
  * Convert the model instance to an array.
  *
  * @return array
  */
 public function toArray()
 {
     $data = parent::toArray();
     if (isset($data['publish_at']) && $data['publish_at']) {
         $data['publish_at'] = $this->publish_at->format('Y-m-d');
     }
     return $data;
 }