PHP code example of fuelviews / laravel-sabhero-blog

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

    

fuelviews / laravel-sabhero-blog example snippets


use Fuelviews\SabHeroBlog\Facades\SabHeroBlog;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            SabHeroBlog::make()
        ]);
}

use Filament\Models\Contracts\FilamentUser;
use Filament\Models\Contracts\HasAvatar;
use Filament\Panel;
use Fuelviews\SabHeroBlog\Traits\HasAuthor;
use Fuelviews\SabHeroBlog\Traits\HasBlog;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;

class User extends Authenticatable implements FilamentUser, HasAvatar
{
    use HasFactory, Notifiable, HasBlog, HasAuthor;
    
    public function canAccessPanel(Panel $panel): bool
    {
        $allowedDomains = ['@fuelviews.com', 'admin.com'];

        foreach ($allowedDomains as $domain) {
            if (str_ends_with($this->email, $domain)) {
                return true;
            }
        }

        return false;
    }
}
bash
php artisan make:filament-user
bash
php artisan vendor:publish --tag="sabhero-blog-config"
bash
php artisan vendor:publish --tag="sabhero-blog-migrations"
bash
php artisan migrate
bash
php artisan vendor:publish --tag="sabhero-blog-feed-config"