2014-06-29 15:12:33 -05:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
2014-07-05 12:44:26 -05:00
|
|
|
class Component extends Firefly\Database\SingleTableInheritanceEntity
|
2014-06-29 15:12:33 -05:00
|
|
|
{
|
2014-07-05 12:44:26 -05:00
|
|
|
|
|
|
|
protected $table = 'components';
|
|
|
|
protected $subclassField = 'class';
|
|
|
|
|
2014-07-05 09:19:15 -05:00
|
|
|
public static $rules
|
|
|
|
= [
|
|
|
|
'user_id' => 'exists:users,id|required',
|
|
|
|
'name' => 'required|between:1,255',
|
|
|
|
'component_type_id' => 'required|exists:component_types,id'
|
|
|
|
];
|
|
|
|
|
|
|
|
|
2014-06-29 15:12:33 -05:00
|
|
|
public function transactions()
|
|
|
|
{
|
|
|
|
return $this->belongsToMany('Transaction');
|
|
|
|
}
|
2014-07-05 12:44:26 -05:00
|
|
|
public function transactionjournals()
|
|
|
|
{
|
|
|
|
return $this->belongsToMany('TransactionJournal');
|
|
|
|
}
|
2014-06-29 15:12:33 -05:00
|
|
|
|
|
|
|
public function user()
|
|
|
|
{
|
|
|
|
return $this->belongsTo('User');
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|