diff --git a/README.md b/README.md index 53e994a..87bbb27 100644 --- a/README.md +++ b/README.md @@ -33,15 +33,17 @@ public/ There are some function that you can use to get content from your site. ### Get all content in a directory + ```php -foreach (cf()->index('post') as $post) { +foreach (lina()->index('post') as $post) { echo $post->title; } ``` ### Get a single content + ```php -$post = cf()->get('posts/2020-11-01-hello.md'); +$post = lina()->get('posts/2020-11-01-hello.md'); ``` - [x] Add `lina serve` command for development diff --git a/bootstrap/helpers.php b/bootstrap/helpers.php index 7a3b692..6e84023 100644 --- a/bootstrap/helpers.php +++ b/bootstrap/helpers.php @@ -3,7 +3,7 @@ use BangNokia\Lina\ContentFinder; if (!function_exists('list_content')) { - function cf(): ContentFinder + function lina(): ContentFinder { return app(ContentFinder::class); } diff --git a/skeleton/content/index.md b/skeleton/content/index.md index 7a8466b..a7d6720 100644 --- a/skeleton/content/index.md +++ b/skeleton/content/index.md @@ -36,13 +36,15 @@ public/ There are some function that you can use to get content from your site. ### Get all content in a directory + ```php -foreach (cf()->index('post') as $post) { +foreach (lina()->index('post') as $post) { echo $post->title; } ``` ### Get a single content + ```php -$post = cf()->get('posts/2020-11-01-hello.md'); +$post = lina()->get('posts/2020-11-01-hello.md'); ``` diff --git a/skeleton/resources/views/home.blade.php b/skeleton/resources/views/home.blade.php index a26e5a7..870c88b 100644 --- a/skeleton/resources/views/home.blade.php +++ b/skeleton/resources/views/home.blade.php @@ -1,7 +1,7 @@ @extends('app') @php - $posts = collect(cf()->index('posts'))->sort(fn($a, $b) => $b->createdAt <=> $a->createdAt); + $posts = collect(lina()->index('posts'))->sort(fn($a, $b) => $b->createdAt <=> $a->createdAt); @endphp @section('content') @@ -16,7 +16,8 @@ @foreach($posts as $post)