calebporzio / bear-sync
此包已被废弃,不再维护。未建议替代包。
在 Laravel 中访问 Bear 笔记
v1.2.0
2020-02-29 14:28 UTC
Requires
- illuminate/database: ~5.8.0|^6.0|^7.0
- illuminate/filesystem: ~5.8.0|^6.0|^7.0
- illuminate/support: ~5.8.0|^6.0|^7.0
This package is auto-updated.
Last update: 2024-01-29 03:41:55 UTC
README
此包提供了一个名为 BearNote
的 Eloquent 模型,它可以无任何配置访问您的本地 Bear 笔记。
安装
composer require calebporzio/bear-sync
使用
基本用法
$note = BearSync\BearNote::whereTitle('Some Note Title')->first(); App\Post::create([ 'title' => $note->title, 'content' => $note->content, ])
完整 API
// Search all your Bear notes. $notes = BearSync\BearNote::searchByTitle('Some Note Title'); // Find a specific note. $note = BearSync\BearNote::whereTitle('Some Note Title')->first(); // Get tags by note $tags = $note->tags // Find a Bear tag named "blog" $tag = BearSync\BearTag::whereTitle('blog')->first(); // Get Bear notes by tag $notes = $tag->notes; // Access the note's contents. $note->id; // Bear's note id. $note->title; $note->content; $note->checksum; // A checksum of the note's content, so you can detect updates. // Fetch it's content and replace/store images. $note->getContentAndStoreImages(function ($originalPath, $newFileName) { $publicFileName = "/images/{$newFileName}"; // Copy the image and store it locally (presumably in a public directory). \File::copy($originalPath, public_path($publicFileName)); // Return the file path to be referenced in the Bear note's markdown. //  return $publicFileName; });