. */ declare(strict_types=1); namespace FireflyIII\Models; use FireflyIII\User; use Illuminate\Database\Eloquent\Model; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** * Class ExportJob. * * @property User $user * @property string $key * @property int $user_id * @property mixed status */ class ExportJob extends Model { /** @var array */ protected $casts = [ 'created_at' => 'datetime', 'updated_at' => 'datetime', ]; /** * @param string $value * * @return ExportJob * * @throws NotFoundHttpException */ public static function routeBinder(string $value): ExportJob { if (auth()->check()) { $key = trim($value); $exportJob = auth()->user()->exportJobs()->where('key', $key)->first(); if (null !== $exportJob) { return $exportJob; } } throw new NotFoundHttpException; } /** * @codeCoverageIgnore * * @param $status */ public function change($status) { $this->status = $status; $this->save(); } /** * @codeCoverageIgnore * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function user() { return $this->belongsTo(User::class); } }