1. Go to this page and download the library: Download firefly/filament-blog library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
firefly / filament-blog example snippets
'tables' => [
'prefix' => 'fblog_', // prefix for all blog tables
],
/**
* |--------------------------------------------------------------------------
* | Set up your blog configuration
* |--------------------------------------------------------------------------
* |
* | The route configuration is for setting up the route prefix and middleware.
* | The user configuration is for setting up the user model and columns.
* | The seo configuration is for setting up the default meta tags for the blog.
* | The recaptcha configuration is for setting up the recaptcha for the blog.
* | The filesystem configuration is for setting up the filesystem for the blog.
*/
use Firefly\FilamentBlog\Models\User;
return [
/**
* ------------------------------------------------------------
* Tables
* This is the prefix for all blog tables.
* ------------------------------------------------------------
*/
'tables' => [
'prefix' => 'fblog_',
],
/**
* ------------------------------------------------------------
* Route
* This is the route configuration for the blog.
* ------------------------------------------------------------
*/
'route' => [
'prefix' => 'blogs',
'middleware' => ['web'],
'home' => [
'name' => 'filamentblog.home',
'url' => env('APP_URL'),
],
'login' => [
'name' => 'filamentblog.post.login',
],
],
/**
* ------------------------------------------------------------
* User
* This is the user configuration for the blog.
* ------------------------------------------------------------
*/
'user' => [
'model' => User::class,
'foreign_key' => 'user_id',
'columns' => [
'name' => 'name',
'avatar' => 'profile_photo_path',
],
],
/**
* ------------------------------------------------------------
* SEO
* This is the SEO configuration for the blog.
* ------------------------------------------------------------
*/
'seo' => [
'meta' => [
'title' => 'Filament Blog',
'description' => 'This is filament blog seo meta description',
'keywords' => [],
],
],
/**
* ------------------------------------------------------------
* Recaptcha
* This is the recaptcha configuration for the blog.
* ------------------------------------------------------------
*/
'recaptcha' => [
'enabled' => false,
'site_key' => env('RECAPTCHA_SITE_KEY'),
'secret_key' => env('RECAPTCHA_SECRET_KEY'),
],
/**
* ------------------------------------------------------------
* Filesystem
* This is the filesystem configuration for the blog.
* ------------------------------------------------------------
*/
'filesystem' => [
'visibility' => 'public',
'disk' => 'public',
],
];
use Firefly\FilamentBlog\Blog;
public function panel(Panel $panel): Panel
{
return $panel
->plugins([
Blog::make()
])
}
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Firefly\FilamentBlog\Traits\HasBlog;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
use HasBlog;
}
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Firefly\FilamentBlog\Traits\HasBlog;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
public function canComment(): bool
{
// your conditional logic here
return true;
}
}