mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-20 03:08:11 +00:00
Some new code for CSV.
This commit is contained in:
@@ -216,7 +216,7 @@ class TransactionJournal extends TransactionJournalSupport
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getMeta($fieldName): string
|
public function getMeta($fieldName)
|
||||||
{
|
{
|
||||||
foreach ($this->transactionjournalmeta as $meta) {
|
foreach ($this->transactionjournalmeta as $meta) {
|
||||||
if ($meta->name == $fieldName) {
|
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 whereName($value)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournalMeta whereData($value)
|
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournalMeta whereData($value)
|
||||||
* @mixin \Eloquent
|
* @mixin \Eloquent
|
||||||
|
* @property string $hash
|
||||||
|
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournalMeta whereHash($value)
|
||||||
*/
|
*/
|
||||||
class TransactionJournalMeta extends Model
|
class TransactionJournalMeta extends Model
|
||||||
{
|
{
|
||||||
|
|
||||||
protected $dates = ['created_at', 'updated_at'];
|
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';
|
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
|
* @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();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user