diff --git a/app/Models/ExportJob.php b/app/Models/ExportJob.php new file mode 100644 index 0000000000..29551fb331 --- /dev/null +++ b/app/Models/ExportJob.php @@ -0,0 +1,64 @@ +where('user_id', Auth::user()->id)->first(); + if (!is_null($model)) { + return $model; + } + } + throw new NotFoundHttpException; + } + + /** + * @param $status + */ + public function change($status) + { + $this->status = $status; + $this->save(); + } + + /** + * @codeCoverageIgnore + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function user() + { + return $this->belongsTo('FireflyIII\User'); + } +} diff --git a/app/User.php b/app/User.php index c183f7b64a..3019d258ff 100644 --- a/app/User.php +++ b/app/User.php @@ -29,6 +29,7 @@ use Zizaco\Entrust\Traits\EntrustUserTrait; * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Role[] $roles * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\RuleGroup[] $ruleGroups * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Rule[] $rules + * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\ExportJob[] $exportjobs */ class User extends Authenticatable { @@ -97,6 +98,14 @@ class User extends Authenticatable return $this->hasMany('FireflyIII\Models\Category'); } + /** + * @return \Illuminate\Database\Eloquent\Relations\HasMany + */ + public function exportjobs() + { + return $this->hasMany('FireflyIII\Models\ExportJob'); + } + /** * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough */