Created
October 19, 2020 20:14
-
-
Save harryWonder/6d0729cf93f9bd2b7d6e2cf0ce88a7cf to your computer and use it in GitHub Desktop.
This is the forum model for the ld-fullstack blog topic
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
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