- Removed php doc.

- Added book_date and rent_date as fillable fields.
This commit is contained in:
James Cole 2016-03-02 11:50:37 +01:00
parent d6e2d8e4a2
commit b0cc6dd714

View File

@ -11,65 +11,22 @@ use Illuminate\Database\Eloquent\SoftDeletes;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Watson\Validating\ValidatingTrait; use Watson\Validating\ValidatingTrait;
/**
* FireflyIII\Models\TransactionJournal
*
* @property integer $id
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property \Carbon\Carbon $deleted_at
* @property integer $user_id
* @property integer $transaction_type_id
* @property integer $bill_id
* @property integer $transaction_currency_id
* @property string $description
* @property boolean $completed
* @property \Carbon\Carbon $date
* @property boolean $encrypted
* @property integer $order
* @property integer $tag_count
* @property-read Bill $bill
* @property-read \Illuminate\Database\Eloquent\Collection|Budget[] $budgets
* @property-read \Illuminate\Database\Eloquent\Collection|Category[] $categories
* @property-read mixed $amount_positive
* @property-read mixed $amount
* @property-read \Illuminate\Database\Eloquent\Collection|Tag[] $tags
* @property-read \Illuminate\Database\Eloquent\Collection|Transaction[] $transactions
* @property-read mixed $destination_account
* @property-read mixed $source_account
* @property-read \Illuminate\Database\Eloquent\Collection|PiggyBankEvent[] $piggyBankEvents
* @property-read \Illuminate\Database\Eloquent\Collection|Attachment[] $attachments
* @property-read TransactionCurrency $transactionCurrency
* @property-read TransactionType $transactionType
* @property-read \Illuminate\Database\Eloquent\Collection|TransactionGroup[] $transactiongroups
* @property-read \FireflyIII\User $user
* @property float $journalAmount
* @property int $account_id
* @property int $budget_id
* @property string $account_name
* @method static \Illuminate\Database\Query\Builder|TransactionJournal accountIs($account)
* @method static \Illuminate\Database\Query\Builder|TransactionJournal after($date)
* @method static \Illuminate\Database\Query\Builder|TransactionJournal before($date)
* @method static \Illuminate\Database\Query\Builder|TransactionJournal onDate($date)
* @method static \Illuminate\Database\Query\Builder|TransactionJournal transactionTypes($types)
* @method static \Illuminate\Database\Query\Builder|TransactionJournal withRelevantData()
* @property string $type
* @property \Carbon\Carbon $interest_date
* @property \Carbon\Carbon $book_date
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournalMeta[] $transactionjournalmeta
*/
class TransactionJournal extends Model class TransactionJournal extends Model
{ {
use SoftDeletes, ValidatingTrait; use SoftDeletes, ValidatingTrait;
/** @var array */ /** @var array */
protected $dates = ['created_at', 'updated_at', 'date', 'deleted_at', 'interest_date', 'book_date']; protected $dates = ['created_at', 'updated_at', 'date', 'deleted_at', 'interest_date', 'book_date'];
/** @var array */ /** @var array */
protected $fillable protected $fillable
= ['user_id', 'transaction_type_id', 'bill_id', 'transaction_currency_id', 'description', 'completed', 'date', 'encrypted', 'tag_count']; = ['user_id', 'transaction_type_id', 'bill_id',
'transaction_currency_id', 'description', 'completed',
'date', 'rent_date', 'book_date', 'encrypted', 'tag_count'];
/** @var array */ /** @var array */
protected $hidden = ['encrypted']; protected $hidden = ['encrypted'];
/** @var array */ /** @var array */
protected $rules protected $rules
= [ = [
@ -86,24 +43,6 @@ class TransactionJournal extends Model
/** @var bool */ /** @var bool */
private $joinedTransactionTypes; private $joinedTransactionTypes;
/**
*
* @param string $fieldName
*
* @return string
*/
public function getMeta($fieldName): string
{
foreach ($this->transactionjournalmeta as $meta) {
if ($meta->name == $fieldName) {
return $meta->data;
}
}
return '';
}
/** /**
* @param $value * @param $value
* *
@ -227,6 +166,23 @@ class TransactionJournal extends Model
return $account; return $account;
} }
/**
*
* @param string $fieldName
*
* @return string
*/
public function getMeta($fieldName): string
{
foreach ($this->transactionjournalmeta as $meta) {
if ($meta->name == $fieldName) {
return $meta->data;
}
}
return '';
}
/** /**
* @return Account * @return Account
*/ */