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

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