PHP code example of nody / nody-blog

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

    

nody / nody-blog example snippets


        'media' => [
            'driver' => 'local',
            'root' => storage_path('app/public/images'),
            'url' => env('APP_URL') . '/storage/images',
            'visibility' => 'public',
            'throw' => false,
        ],

    use Nody\NodyBlog\Models\Post;
    use Nody\NodyBlog\Livewire\PostComments;

    public function posts()
    {
        return $this->hasMany(Post::class);
    }

    public function likes()
    {
        return $this->belongsToMany(Post::class, 'post_like')->withTimestamps();
    }

    public function hasLiked(Post $post)
    {
        return $this->likes()->where('post_id', $post->id)->exists();
    }

    public function comments()
    {
        return $this->hasMany(PostComments::class);
    }

    use Nody\NodyBlog\NodyBlogPlugin;

    ->plugin(new NodyBlogPlugin());

    $builder->group('Blog', [
        ...CategoryResource::getNavigationItems(),
        ...PostResource::getNavigationItems(),
        ...TagResource::getNavigationItems(),
        ...CommentResource::getNavigationItems(),
    ]);
bash
php artisan nody-blog:install
bash
php artisan vendor:publish --provider="Spatie\MediaLibrary\MediaLibraryServiceProvider" --tag="medialibrary-migrations"

php artisan migrate
bash
php artisan vendor:publish --provider="Nody\NodyBlog\NodyBlogServiceProvider" --tag="nody-blog-translations"
bash
php artisan storage:link