API for object groups.

This commit is contained in:
James Cole
2020-06-20 16:28:23 +02:00
parent c40f6f2864
commit 1a154a8d45
11 changed files with 416 additions and 2 deletions

View File

@@ -4,7 +4,9 @@ declare(strict_types=1);
namespace FireflyIII\Models;
use FireflyIII\User;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
@@ -33,6 +35,19 @@ class ObjectGroup extends Model
{
protected $fillable = ['title', 'order', 'user_id'];
/**
* The attributes that should be casted to native types.
*
* @var array
*/
protected $casts
= [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'user_id' => 'integer',
'deleted_at' => 'datetime',
];
/**
* @return \Illuminate\Database\Eloquent\Relations\MorphToMany
*/
@@ -61,4 +76,13 @@ class ObjectGroup extends Model
}
throw new NotFoundHttpException;
}
/**
* @return BelongsTo
* @codeCoverageIgnore
*/
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
}