Posts.php 339 B

1234567891011121314151617181920212223
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. class Post extends Model
  5. {
  6. protected $fillable = ['titre','contenu','user_id'];
  7. public $timestamps = true;
  8. public function user()
  9. {
  10. return $this->belongsTo('App\Models\User');
  11. }
  12. public function tags()
  13. {
  14. return $this->belongsToMany('App\Tag');
  15. }
  16. }