public function testGettingNewCollection() { $model = new TranslationModel(); $collection = $model->newCollection([1, 2]); $this->assertInstanceOf(SimpleTranslationCollection::class, $collection); $this->assertSame(2, $collection->count()); }
/** * 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; }