Post.php 300 B

123456789101112131415161718192021
  1. <?php
  2. namespace App;
  3. use Illuminate\Database\Eloquent\Model;
  4. class Post extends Model
  5. {
  6. //
  7. protected $fillable = ['text', 'title'];
  8. public function comments(){
  9. return $this->hasMany('App\Comment');
  10. }
  11. public function tags(){
  12. return $this->belongsToMany('App\Tag');
  13. }
  14. }