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
|
|
|
|
2014-07-05 09:19:15 -05:00
|
|
|
public static $rules
|
|
|
|
= [
|
|
|
|
'user_id' => 'exists:users,id|required',
|
|
|
|
'name' => 'required|between:1,255',
|
2014-07-06 08:18:11 -05:00
|
|
|
'class' => 'required',
|
2014-07-05 09:19:15 -05:00
|
|
|
];
|
2014-07-06 08:18:11 -05:00
|
|
|
protected $table = 'components';
|
|
|
|
protected $subclassField = 'class';
|
2014-07-05 09:19:15 -05:00
|
|
|
|
2014-07-09 06:35:33 -05:00
|
|
|
public static $factory = [
|
|
|
|
'name' => 'string',
|
|
|
|
'user_id' => 'factory|User',
|
|
|
|
];
|
|
|
|
|
2014-06-29 15:12:33 -05:00
|
|
|
public function transactions()
|
|
|
|
{
|
|
|
|
return $this->belongsToMany('Transaction');
|
|
|
|
}
|
2014-07-06 08:18:11 -05:00
|
|
|
|
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');
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|