diff options
Diffstat (limited to 'app/Category.php')
| -rw-r--r-- | app/Category.php | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/app/Category.php b/app/Category.php new file mode 100644 index 0000000..7f0cdb2 --- /dev/null +++ b/app/Category.php @@ -0,0 +1,18 @@ +<?php + +namespace App; + +use Illuminate\Database\Eloquent\Model; + +class Category extends Model +{ + protected $table = "category"; + protected $fillable = [ + 'id', + 'name' + ]; + + public function getArticles(){ + return $this->belongsToMany('App\Article', 'article_category'); + } +} |
