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/ */
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());