Update ImportJob model

This commit is contained in:
Daniel Supernault 2018-09-09 22:43:42 -06:00
parent 16399e93fb
commit fbc15e8a07
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -6,5 +6,19 @@ use Illuminate\Database\Eloquent\Model;
class ImportJob extends Model
{
//
public function url()
{
return url("/i/import/job/{$this->uuid}/{$this->stage}");
}
public function files()
{
return $this->hasMany(ImportData::class, 'job_id');
}
public function mediaJson()
{
$path = storage_path("app/$this->media_json");
return json_decode(file_get_contents($path), true);
}
}