Repository: ryangjchandler/orbit (php)

Issue:
Fix `Markdown` driver messing with arrays
Currently, the `Markdown` driver is turning `array` casts into strings. The problem is with `$model->getAttributes()`, which returns the attributes after being casted into their raw form.

Pull request description:
fix: markdown front matter array formatting
Closes #21.

Patch:
diff --git a/src/Drivers/Markdown.php b/src/Drivers/Markdown.php
index d0828ce..647a329 100644
--- a/src/Drivers/Markdown.php
+++ b/src/Drivers/Markdown.php
@@ -37,7 +37,7 @@ class Markdown implements Driver
             file_put_contents($path, '');
         }
 
-        $matter = array_filter($model->getAttributes(), function ($value, $key) {
+        $matter = array_filter($model->attributesToArray(), function ($value, $key) {
             return $key !== 'content' && $value !== null;
         }, ARRAY_FILTER_USE_BOTH);
 


Test patch:
diff --git a/tests/SoftDeletesTest.php b/tests/SoftDeletesTest.php
index be93b82..51d50a5 100644
--- a/tests/SoftDeletesTest.php
+++ b/tests/SoftDeletesTest.php
@@ -18,7 +18,7 @@ class SoftDeletesTest extends TestCase
 
         $file = file_get_contents(__DIR__.'/content/soft_deleted_posts/'.$post->id.'.md');
 
-        $this->assertStringContainsString(sprintf('deleted_at: \'%s\'', $post->deleted_at), $file);
+        $this->assertStringContainsString(sprintf('deleted_at: \'%s\'', $post->deleted_at->toIsoString()), $file);
     }
 
     public function test_it_will_delete_file_when_force_deleting()
@@ -33,7 +33,7 @@ class SoftDeletesTest extends TestCase
 
         $file = file_get_contents(__DIR__.'/content/soft_deleted_posts/'.$post->id.'.md');
 
-        $this->assertStringContainsString(sprintf('deleted_at: \'%s\'', $post->deleted_at), $file);
+        $this->assertStringContainsString(sprintf('deleted_at: \'%s\'', $post->deleted_at->toIsoString()), $file);
 
         $post->forceDelete();
 
@@ -52,7 +52,7 @@ class SoftDeletesTest extends TestCase
 
         $file = file_get_contents(__DIR__.'/content/soft_deleted_posts/'.$post->id.'.md');
 
-        $this->assertStringContainsString(sprintf('deleted_at: \'%s\'', $post->deleted_at), $file);
+        $this->assertStringContainsString(sprintf('deleted_at: \'%s\'', $post->deleted_at->toIsoString()), $file);
 
         $post->restore();