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.

26 lines
441 B

<?php
namespace App\Models;
class AppointmentType extends SoftDeletesModel
{
protected $casts = ['image_id' => 'json'];
protected $appends = ['image'];
public function getImageAttribute($value)
{
if (empty($this->image_id)) return [];
return Upload::whereIn('id', $this->image_id)->get();
}
public function image()
{
return $this->hasOne(Upload::class, 'id', 'image_id');
}
}