2018-07-18 00:02:07 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App;
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
|
|
|
class ImportJob extends Model
|
|
|
|
{
|
2018-09-16 22:53:21 +00:00
|
|
|
public function profile()
|
|
|
|
{
|
|
|
|
return $this->belongsTo(Profile::class, 'profile_id');
|
|
|
|
}
|
|
|
|
|
2018-09-10 04:43:42 +00:00
|
|
|
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);
|
|
|
|
}
|
2018-07-18 00:02:07 +00:00
|
|
|
}
|