SmartCane/laravel_app/app/Models/ProjectBoundingBox.php

35 lines
729 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class ProjectBoundingBox extends Model
{
use HasFactory;
protected $fillable = [
'name',
'top_left_latitude',
'top_left_longitude',
'bottom_right_latitude',
'bottom_right_longitude',
];
public function project()
{
return $this->belongsTo(Project::class);
}
public function toArrayCustom()
{
return [
(float) $this->top_left_latitude,
(float) $this->top_left_longitude,
(float) $this->bottom_right_latitude,
(float) $this->bottom_right_longitude
];
}
}