選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

HasParentRelationship.php 468B

12345678910111213141516171819
  1. <?php
  2. namespace Database\Factories\Concerns;
  3. use Illuminate\Database\Eloquent\Model;
  4. trait HasParentRelationship
  5. {
  6. public function useParentCompany(): self
  7. {
  8. return $this->state(function (array $attributes, Model $parent) {
  9. return [
  10. 'company_id' => $parent->company_id,
  11. 'created_by' => $parent->created_by ?? 1,
  12. 'updated_by' => $parent->updated_by ?? 1,
  13. ];
  14. });
  15. }
  16. }