Category.php 605 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Model\OldModel;
  4. use Hyperf\DbConnection\Model\Model;
  5. /**
  6. */
  7. class Category extends Model
  8. {
  9. /**
  10. * The table associated with the model.
  11. */
  12. protected ?string $table = 'category';
  13. protected ?string $connection = 'secondary';
  14. /**
  15. * The attributes that are mass assignable.
  16. */
  17. protected array $fillable = [];
  18. /**
  19. * The attributes that should be cast to native types.
  20. */
  21. protected array $casts = [];
  22. public function info()
  23. {
  24. return $this->hasMany(Article::class, 'id','catid');
  25. }
  26. }