mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 00:27:30 +00:00
Various code cleanup.
This commit is contained in:
@@ -24,22 +24,23 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Eloquent;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
use Carbon\Carbon;
|
||||
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
/**
|
||||
* FireflyIII\Models\Location
|
||||
*
|
||||
* @property int|string $id
|
||||
* @property int $id
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property Carbon|null $deleted_at
|
||||
* @property int|string $locatable_id
|
||||
* @property int $locatable_id
|
||||
* @property string $locatable_type
|
||||
* @property float|null $latitude
|
||||
* @property float|null $longitude
|
||||
@@ -63,6 +64,7 @@ use Carbon\Carbon;
|
||||
*/
|
||||
class Location extends Model
|
||||
{
|
||||
use ReturnsIntegerIdTrait;
|
||||
|
||||
protected $casts
|
||||
= [
|
||||
@@ -110,4 +112,16 @@ class Location extends Model
|
||||
{
|
||||
return $this->morphTo();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Attribute
|
||||
*/
|
||||
protected function locatableId(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn($value) => (int)$value,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user