|
|
|
@ -55,7 +55,11 @@ class CompanyController extends BaseController
|
|
|
|
public function index()
|
|
|
|
public function index()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$all = request()->all();
|
|
|
|
$all = request()->all();
|
|
|
|
$list = $this->model->with('users')->where(function ($query) use ($all) {
|
|
|
|
$list = $this->model->with(['users' => function ($query) {
|
|
|
|
|
|
|
|
$query->whereHas('courseSigns', function ($q) {
|
|
|
|
|
|
|
|
$q->where('status', 1);
|
|
|
|
|
|
|
|
})->with('courseSigns.course');
|
|
|
|
|
|
|
|
}])->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;
|
|
|
|
@ -148,7 +152,11 @@ class CompanyController 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->with('users')->find($all['id']);
|
|
|
|
$detail = $this->model->with(['users' => function ($query) {
|
|
|
|
|
|
|
|
$query->whereHas('courseSigns', function ($q) {
|
|
|
|
|
|
|
|
$q->where('status', 1);
|
|
|
|
|
|
|
|
})->with('courseSigns.course');
|
|
|
|
|
|
|
|
}])->find($all['id']);
|
|
|
|
return $this->success($detail);
|
|
|
|
return $this->success($detail);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|