mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Code clean up and reformat.
This commit is contained in:
@@ -5,44 +5,24 @@ use LaravelBook\Ardent\Ardent;
|
||||
/**
|
||||
* Preference
|
||||
*
|
||||
* @property integer $id
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property integer $user_id
|
||||
* @property string $name
|
||||
* @property string $data
|
||||
* @property-read \User $user
|
||||
* @method static \Illuminate\Database\Query\Builder|\Preference whereId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Preference whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Preference whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Preference whereUserId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Preference whereName($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Preference whereData($value)
|
||||
* @property integer $user_id
|
||||
* @property string $name
|
||||
* @property string $data
|
||||
* @property-read \User $user
|
||||
* @method static \Illuminate\Database\Query\Builder|\Preference whereId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Preference whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Preference whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Preference whereUserId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Preference whereName($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Preference whereData($value)
|
||||
*/
|
||||
class Preference extends Ardent
|
||||
{
|
||||
public static $rules
|
||||
= [
|
||||
'user_id' => 'required|exists:users,id',
|
||||
'name' => 'required|between:1,255',
|
||||
'data' => 'required'
|
||||
];
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('User');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
*/
|
||||
public function setDataAttribute($value)
|
||||
{
|
||||
$this->attributes['data'] = json_encode($value);
|
||||
}
|
||||
= ['user_id' => 'required|exists:users,id', 'name' => 'required|between:1,255', 'data' => 'required'];
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
@@ -54,4 +34,20 @@ class Preference extends Ardent
|
||||
return json_decode($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
*/
|
||||
public function setDataAttribute($value)
|
||||
{
|
||||
$this->attributes['data'] = json_encode($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('User');
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user