ImportJob.php 561 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace App;
  3. use Illuminate\Database\Eloquent\Model;
  4. class ImportJob extends Model
  5. {
  6. public function profile()
  7. {
  8. return $this->belongsTo(Profile::class, 'profile_id');
  9. }
  10. public function url()
  11. {
  12. return url("/i/import/job/{$this->uuid}/{$this->stage}");
  13. }
  14. public function files()
  15. {
  16. return $this->hasMany(ImportData::class, 'job_id');
  17. }
  18. public function mediaJson()
  19. {
  20. $path = storage_path("app/$this->media_json");
  21. return json_decode(file_get_contents($path), true);
  22. }
  23. }