public function testFetchAllPosts() { $samples = 5; $postIds = []; for ($i = 0; $i < $samples; $i++) { $postIds[] = static::insertSamplePost(); } $posts = Post::all(); $this->assertCount($samples, $posts); foreach ($posts as $post) { $this->assertInstanceOf(Post::class, $post); } }
public static function getAppendContent(Post $object) { if (!empty($object->toArray())) { $fields = collect($object->toArray()); return self::generateContentFromArray($fields); } }