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.

28 lines
494 B

11 months ago
<?php
namespace App\Models;
class Study extends SoftDeletesModel
{
11 months ago
protected $guarded = ['id'];
11 months ago
protected $casts = [
11 months ago
'file' => 'json'
11 months ago
];
11 months ago
protected $appends = ['file_detail'];
11 months ago
11 months ago
public function asks()
11 months ago
{
11 months ago
return $this->hasMany(StudyAsk::class, 'study_id', 'id');
11 months ago
}
11 months ago
public function getFileDetailAttribute()
11 months ago
{
11 months ago
if (empty($this->file)) {
11 months ago
return [];
}
return Upload::whereIn('id', $this->file)->get();
}
}