Trace.php 519 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace App;
  3. use Illuminate\Database\Eloquent\Model;
  4. class Trace extends Model
  5. {
  6. // public $fillable = ['key', 'gid', 'slug', 'group'];
  7. protected $guarded = [];
  8. public $appends = [];
  9. public function good()
  10. {
  11. return $this->belongsTo(Good::class, 'gid');
  12. }
  13. public function getUrlAttribute()
  14. {
  15. return config('app.url') . '/key/' . $this->attributes['slug'];
  16. }
  17. public function dealer()
  18. {
  19. return $this->belongsTo(Dealer::class);
  20. }
  21. }