停车场管理系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

59 lines
1.2 KiB

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class ParkingSpace extends Model
{
use HasFactory;
protected $table = 'parking_space';
protected $fillable
= [
'floor_id',
'number',
'space_attr_id',
'license_plate_id',
'berthing_time',
'recognition',
'status',
'space_type_id',
'operation_type'
];
protected $hidden
= [
'created_at'
];
public function getUpdatedAtAttribute($value): string
{
return is_null($value)
? ''
: get_datetime(
'date_time',
strtotime($value)
);
}
public static function getNumber($id)
{
return self::query()->where('id', $id)->value('number');
}
public static function getId($number)
{
return self::query()->where('number', 'like', "%{$number}%")->pluck(
'id'
)->toArray();
}
public static function getValueId($number): string
{
return self::query()->where('number', $number)->value('id');
}
}