NewsCategory.php 505B

123456789101112131415161718192021222324
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Casts\Attribute;
  4. use Illuminate\Database\Eloquent\Model;
  5. use Illuminate\Database\Eloquent\SoftDeletes;
  6. use Spatie\Translatable\HasTranslations;
  7. class NewsCategory extends Model
  8. {
  9. use HasTranslations; use SoftDeletes;
  10. const VISIBLE_Y = "顯示";
  11. const VISIBLE_N = "不顯示";
  12. protected $guarded = ['id'];
  13. public $translatable = ['name'];
  14. public function news(){
  15. return $this->hasMany(News::class);
  16. }
  17. }