mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Some new code for CSV.
This commit is contained in:
parent
ddb28b78c3
commit
5ed53d5f04
@ -216,7 +216,7 @@ class TransactionJournal extends TransactionJournalSupport
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getMeta($fieldName): string
|
||||
public function getMeta($fieldName)
|
||||
{
|
||||
foreach ($this->transactionjournalmeta as $meta) {
|
||||
if ($meta->name == $fieldName) {
|
||||
|
@ -31,14 +31,36 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournalMeta whereName($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournalMeta whereData($value)
|
||||
* @mixin \Eloquent
|
||||
* @property string $hash
|
||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournalMeta whereHash($value)
|
||||
*/
|
||||
class TransactionJournalMeta extends Model
|
||||
{
|
||||
|
||||
protected $dates = ['created_at', 'updated_at'];
|
||||
protected $fillable = ['transaction_journal_id', 'name', 'data'];
|
||||
protected $fillable = ['transaction_journal_id', 'name', 'data','hash'];
|
||||
protected $table = 'journal_meta';
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getDataAttribute($value)
|
||||
{
|
||||
return json_decode($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
*/
|
||||
public function setDataAttribute($value)
|
||||
{
|
||||
$data = json_encode($value);
|
||||
$this->attributes['data'] = $data;
|
||||
$this->attributes['hash'] = hash('sha256', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
|
36
database/migrations/2016_04_08_181054_changes_for_v383.php
Normal file
36
database/migrations/2016_04_08_181054_changes_for_v383.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
|
||||
/**
|
||||
* Class ChangesForV383
|
||||
*/
|
||||
class ChangesForV383 extends Migration
|
||||
{
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
// extend journal meta
|
||||
Schema::table(
|
||||
'journal_meta', function (Blueprint $table) {
|
||||
$table->string('hash', 64)->nullable();
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user