firefly-iii/app/models/Component.php

67 lines
2.0 KiB
PHP
Raw Normal View History

<?php
2014-07-15 15:16:29 -05:00
/**
* Component
*
* @property integer $id
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property string $name
* @property integer $user_id
* @property string $class
* @property-read \Illuminate\Database\Eloquent\Collection|\Limit[] $limits
2014-07-15 15:16:29 -05:00
* @property-read \Illuminate\Database\Eloquent\Collection|\TransactionJournal[] $transactionjournals
* @property-read \Illuminate\Database\Eloquent\Collection|\Transaction[] $transactions
* @property-read \User $user
* @method static \Illuminate\Database\Query\Builder|\Component whereId($value)
* @method static \Illuminate\Database\Query\Builder|\Component whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\Component whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\Component whereName($value)
* @method static \Illuminate\Database\Query\Builder|\Component whereUserId($value)
* @method static \Illuminate\Database\Query\Builder|\Component whereClass($value)
2014-07-15 15:16:29 -05:00
*/
class Component extends Firefly\Database\SingleTableInheritanceEntity
{
public static $rules
= [
'user_id' => 'exists:users,id|required',
'name' => 'required|between:1,255',
'class' => 'required',
];
protected $table = 'components';
protected $subclassField = 'class';
2014-08-10 11:22:42 -05:00
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function limits()
{
2014-08-09 12:10:31 -05:00
return $this->hasMany('Limit');
}
2014-08-10 11:22:42 -05:00
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
public function transactionjournals()
{
return $this->belongsToMany('TransactionJournal');
}
2014-08-10 11:22:42 -05:00
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
2014-08-09 12:10:31 -05:00
public function transactions()
{
return $this->belongsToMany('Transaction');
}
2014-08-10 11:22:42 -05:00
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function user()
{
return $this->belongsTo('User');
}
}