<?php

namespace App;
// use App\Post;

use Illuminate\Database\Eloquent\Model;

class Post extends Model
{
    
    protected $fillable=['title','body','image'];

    public function user()
    {
        return $this->belongsTo(User::class);
    }
    public function comments()
    {
        return $this->morphMany(Comment::class, 'commentable')->whereNull('parent_id');
    }
}
