Skip to content

Commit

Permalink
Update readme with real world example
Browse files Browse the repository at this point in the history
  • Loading branch information
carlcassar committed Mar 24, 2024
1 parent 4194402 commit 1fbea43
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,26 @@ $file->htmlWithToc()
$file->pathname()
```

In my case, I use this package to import the markdown files into my database for [https://www.carlcassar.com](https://www.carlcassar.com):

```php
Article::updateOrCreate([
'slug' => $file->frontMatter()['slug'] ?? Str::slug($file->frontMatter()['title']),
], [
'title' => $file->frontMatter()['title'],
'slug' => $file->frontMatter()['slug'] ?? Str::slug($file->frontMatter()['title']),
'description' => $file->frontMatter()['description'],
'table_of_contents' => $file->toc(),
'content' => $file->html(),
'image' => $file->frontMatter()['image'],
'tags' => $file->frontMatter()['tags'],
'published_at' => Carbon::make($file->frontMatter()['published_at']),
'deleted_at' => Carbon::make($file->frontMatter()['deleted_at']),
'created_at' => Carbon::make($file->frontMatter()['created_at']),
'updated_at' => Carbon::make($file->frontMatter()['updated_at']),
]);
```

## Testing

```bash
Expand Down

0 comments on commit 1fbea43

Please sign in to comment.