mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-29 02:57:45 +00:00
More code for the new CSV import
This commit is contained in:
@@ -12,7 +12,9 @@ declare(strict_types = 1);
|
||||
namespace FireflyIII\Models;
|
||||
|
||||
use Auth;
|
||||
use Crypt;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Storage;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
|
||||
@@ -67,15 +69,6 @@ class ImportJob extends Model
|
||||
$this->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('FireflyIII\User');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
*
|
||||
@@ -86,8 +79,8 @@ class ImportJob extends Model
|
||||
if (strlen($value) == 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return json_decode($value);
|
||||
|
||||
return json_decode($value, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,4 +90,25 @@ class ImportJob extends Model
|
||||
{
|
||||
$this->attributes['configuration'] = json_encode($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function uploadFileContents(): string
|
||||
{
|
||||
$fileName = $this->key . '.upload';
|
||||
$disk = Storage::disk('upload');
|
||||
$encryptedContent = $disk->get($fileName);
|
||||
$content = Crypt::decrypt($encryptedContent);
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('FireflyIII\User');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user