PHP code example of afea / filament-blog

1. Go to this page and download the library: Download afea/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/ */

    

afea / filament-blog example snippets


->plugin(\Afea\Cms\Blog\Filament\BlogPlugin::make())

return [
    'models' => [
        'blog_post' => \Afea\Cms\Blog\Models\BlogPost::class,
        'category' => \Afea\Cms\Blog\Models\Category::class,
        'tag' => \Afea\Cms\Blog\Models\Tag::class,
    ],
    'user_model' => \App\Models\User::class,
    'routing_strategy' => env('AFEA_BLOG_ROUTING_STRATEGY', 'resource'),
    'prefix' => env('AFEA_BLOG_PREFIX', 'blog'),
    'views' => [
        'index' => 'afea-blog::index',
        'show' => 'afea-blog::show',
    ],
    'media' => [
        'disk' => env('AFEA_BLOG_MEDIA_DISK', null),
        'thumbnail_collection' => 'blog-posts/thumbnails',
        'preview_size' => [300, 300],
    ],
];

// app/Models/BlogPost.php
namespace App\Models;

class BlogPost extends \Afea\Cms\Blog\Models\BlogPost
{
    public function scopeFeatured($query)
    {
        return $query->where('is_active', true)->whereNotNull('published_at');
    }
}

// config/afea-blog.php
'models' => ['blog_post' => \App\Models\BlogPost::class],
bash
php artisan vendor:publish --tag=afea-blog-views