Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
This is the forum model for the ld-fullstack blog topic
namespace App;
use Illuminate\Database\Eloquent\Model;
class Forum extends Model
protected $fillable = ['id', 'user_id', 'title', 'content', 'likes', 'comments', 'created_at', 'updated_at'];
public function commentModel()
return $this->hasMany('App\Comment', 'forum_id');
public function user()
return $this->belongsTo('App\User');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment