Requirement.php 985 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace App\Models;
  3. use App\Models\Scopes\CompanyScope;
  4. use Illuminate\Database\Eloquent\Factories\HasFactory;
  5. use Illuminate\Database\Eloquent\Model;
  6. class Requirement extends Model
  7. {
  8. use HasFactory;
  9. protected $fillable = [
  10. 'title',
  11. 'asset_id',
  12. 'status',
  13. 'requirement_group_id',
  14. 'priority',
  15. 'note',
  16. 'description',
  17. 'acceptance',
  18. 'mailto',
  19. 'company_id',
  20. ];
  21. protected $casts = [
  22. 'mailto' => 'array',
  23. ];
  24. protected static function booted()
  25. {
  26. parent::booted(); // TODO: Change the autogenerated stub
  27. static::addGlobalScope(new CompanyScope);
  28. }
  29. public function createdBy(): \Illuminate\Database\Eloquent\Relations\BelongsTo
  30. {
  31. return $this->belongsTo(User::class, 'created_by');
  32. }
  33. public function plan(): \Illuminate\Database\Eloquent\Relations\BelongsTo
  34. {
  35. return $this->belongsTo(Plan::class);
  36. }
  37. }