master
cody 5 months ago
parent 7251441b93
commit d65f015111

@ -53,7 +53,7 @@ class CourseContentEvaluationFormController extends BaseController
public function index() public function index()
{ {
$all = request()->all(); $all = request()->all();
$list = $this->model->with(underlineToHump($all['show_relation'] ?? []))->where(function ($query) use ($all) { $list = $this->model->with('user')->where(function ($query) use ($all) {
if (isset($all['filter']) && !empty($all['filter'])) { if (isset($all['filter']) && !empty($all['filter'])) {
foreach ($all['filter'] as $condition) { foreach ($all['filter'] as $condition) {
$key = $condition['key'] ?? null; $key = $condition['key'] ?? null;
@ -146,7 +146,7 @@ class CourseContentEvaluationFormController 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->with('user')->find($all['id']);
return $this->success($detail); return $this->success($detail);
} }

@ -6,4 +6,9 @@ class CourseContentEvaluationForm extends SoftDeletesModel
{ {
protected $casts = ['data' => 'json']; protected $casts = ['data' => 'json'];
public function user()
{
return $this->hasOne(User::class, 'id', 'user_id');
}
} }

Loading…
Cancel
Save