2014-06-29 22:12:33 +02:00
|
|
|
<?php
|
2014-11-30 14:52:17 +01:00
|
|
|
use Carbon\Carbon;
|
2014-11-12 14:38:32 +01:00
|
|
|
use FireflyIII\Shared\SingleTableInheritanceEntity;
|
2014-12-06 12:12:55 +01:00
|
|
|
use Illuminate\Database\Eloquent\SoftDeletingTrait;
|
|
|
|
|
use Watson\Validating\ValidatingTrait;
|
2014-06-29 22:12:33 +02:00
|
|
|
|
2014-12-13 21:59:02 +01:00
|
|
|
/**
|
|
|
|
|
* Class Component
|
|
|
|
|
*/
|
2014-12-17 20:47:46 +01:00
|
|
|
class Component extends Eloquent
|
2014-06-29 22:12:33 +02:00
|
|
|
{
|
2014-07-05 19:44:26 +02:00
|
|
|
|
2014-07-05 16:19:15 +02:00
|
|
|
public static $rules
|
2014-11-18 09:47:50 +01:00
|
|
|
= [
|
|
|
|
|
'user_id' => 'exists:users,id|required',
|
|
|
|
|
'name' => 'required|between:1,100|alphabasic',
|
|
|
|
|
'class' => 'required',
|
|
|
|
|
];
|
2014-12-06 12:12:55 +01:00
|
|
|
protected $dates = ['deleted_at', 'created_at', 'updated_at'];
|
2014-12-17 20:47:46 +01:00
|
|
|
protected $fillable = ['name', 'user_id','class'];
|
2014-11-12 22:37:44 +01:00
|
|
|
protected $table = 'components';
|
2014-12-16 21:41:16 +01:00
|
|
|
use ValidatingTrait;
|
2014-07-05 16:19:15 +02:00
|
|
|
|
2014-12-17 20:47:46 +01:00
|
|
|
// /**
|
|
|
|
|
// * remove this method in favour of something in the FireflyIII libraries.
|
|
|
|
|
// *
|
|
|
|
|
// * @return Carbon
|
|
|
|
|
// */
|
|
|
|
|
// public function lastActionDate()
|
|
|
|
|
// {
|
|
|
|
|
// $transaction = $this->transactionjournals()->orderBy('updated_at', 'DESC')->first();
|
|
|
|
|
// if (is_null($transaction)) {
|
|
|
|
|
// return null;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// return $transaction->date;
|
|
|
|
|
// }
|
2014-06-29 22:12:33 +02:00
|
|
|
}
|