CategoryTopic.php 522 B

1234567891011121314151617181920212223242526
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Administrator
  5. * Date: 2019/6/6
  6. * Time: 15:34
  7. */
  8. namespace App\Models;
  9. use Illuminate\Database\Eloquent\Model;
  10. class CategoryTopic extends Model
  11. {
  12. //
  13. protected $table = 'category_topic';
  14. protected $guarded = [];
  15. //话题
  16. public function topic()
  17. {
  18. return $this->hasOne('App\Models\Topic', 'id', 'topic_id');
  19. }
  20. //分类
  21. public function category()
  22. {
  23. return $this->hasOne('App\Models\Category', 'id', 'category_id');
  24. }
  25. }