You can install the package via composer:
composer require abr4xas/simple-blog
You can publish and run the migrations and everything else with:
php artisan vendor:publish --provider="Abr4xas\SimpleBlog\SimpleBlogServiceProvider" --tag="simple-blog-migrations"
php artisan migrate
This package uses a polymorphic relationship to associate the Items model with the model of your choice, the only thing you have to do is add the following trait: Abr4xas\SimpleBlog\Traits\HasArticle
to the model you want to use.
$user->articles()->create([
'title' => 'My first fake post',
'slug' => 'my-first-post',
'excerpt' => 'The excerpt of this fake post',
'body' => 'The body of this fake post',
'status' => ArticleStatus::PUBLISHED(), // ArticleStatus::DRAFT()
'file' => 'https://i.pinimg.com/originals/4f/e7/06/4fe7066d4f3aa7201e38484230fc32b3.jpg',
]);
This package uses: Torchlight CommonMark, so, you need an api key to make it work. Follow this docs: https://torchlight.dev/docs/clients/commonmark-php
Edit your config/torchlight.php
file to include the following in the options array:
'copyable' => true,
Next, make sure to register this javascript snippet inside your app.js
file like this:
import Alpine from "alpinejs";
window.Alpine = Alpine;
Alpine.data("codeBlock", () => ({
showMessage: false,
copyToClipboard() {
text = document.querySelector(".torchlight-copy-target").textContent;
navigator.clipboard.writeText(text);
// show the "copied" message for 2 seconds
this.showMessage = true;
setTimeout(() => (this.showMessage = false), 2000);
},
}));
Alpine.start();
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.