master
cody 5 months ago
parent 90018efe00
commit c5bd437214

@ -147,7 +147,7 @@ class EmailTemplateController extends BaseController
if ($validator->fails()) { if ($validator->fails()) {
return $this->fail([ResponseCode::ERROR_PARAMETER, implode(',', $validator->errors()->all())]); return $this->fail([ResponseCode::ERROR_PARAMETER, implode(',', $validator->errors()->all())]);
} }
$detail = $this->model->find($all['id']); $detail = $this->model->withCount('emailRecords')->find($all['id']);
return $this->success($detail); return $this->success($detail);
} }

@ -9,5 +9,10 @@ use Illuminate\Support\Facades\Cache;
class EmailTemplate extends SoftDeletesModel class EmailTemplate extends SoftDeletesModel
{ {
public function emailRecords()
{
return $this->hasMany(EmailRecord::class, 'email_template_id', 'id');
}
} }

Loading…
Cancel
Save