2014-08-18 05:28:33 -05:00
|
|
|
<?php
|
2014-12-06 05:12:55 -06:00
|
|
|
use Watson\Validating\ValidatingTrait;
|
2014-12-20 08:00:53 -06:00
|
|
|
use \Illuminate\Database\Eloquent\Model as Eloquent;
|
2014-12-13 14:59:02 -06:00
|
|
|
/**
|
2014-12-14 14:24:20 -06:00
|
|
|
* Class PiggyBankEvent
|
2014-12-13 14:59:02 -06:00
|
|
|
*/
|
2014-12-14 14:24:20 -06:00
|
|
|
class PiggyBankEvent extends Eloquent
|
2014-08-18 05:28:33 -05:00
|
|
|
{
|
|
|
|
|
2014-08-21 14:00:02 -05:00
|
|
|
public static $rules
|
2014-11-18 02:47:50 -06:00
|
|
|
= [
|
2014-12-24 13:55:42 -06:00
|
|
|
'piggy_bank_id' => 'required|exists:piggy_banks,id',
|
2014-11-18 02:47:50 -06:00
|
|
|
'date' => 'required|date',
|
|
|
|
'amount' => 'required|numeric'
|
|
|
|
];
|
2014-12-14 14:24:20 -06:00
|
|
|
use ValidatingTrait;
|
2014-08-18 05:28:33 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function getDates()
|
|
|
|
{
|
|
|
|
return ['created_at', 'updated_at', 'date'];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
|
|
*/
|
2014-12-24 13:55:42 -06:00
|
|
|
public function piggyBank()
|
2014-08-18 05:28:33 -05:00
|
|
|
{
|
2014-12-24 13:55:42 -06:00
|
|
|
return $this->belongsTo('PiggyBank');
|
2014-08-18 05:28:33 -05:00
|
|
|
}
|
|
|
|
|
2014-11-16 03:31:19 -06:00
|
|
|
/**
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
|
|
*/
|
|
|
|
public function transactionJournal()
|
|
|
|
{
|
|
|
|
return $this->belongsTo('TransactionJournal');
|
|
|
|
}
|
|
|
|
|
2015-01-01 23:16:49 -06:00
|
|
|
}
|