| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 | <?phpnamespace App\Http\Controllers\Mobile\Health;use App\Http\Controllers\Mobile\MobileBaseController;use App\Models\Company;use App\Models\Jobs;use App\Repositories\CategoryRepository;use App\Services\Company\CompanyService;use App\Services\Company\JobsService;use Illuminate\Http\Request;class HospitalController extends MobileBaseController{    protected $companyService;    protected $jobsService;    protected $categoryRepository;    public function __construct(CompanyService $companyService, JobsService $jobsService, CategoryRepository $categoryRepository)    {        $this->companyService     = $companyService;        $this->jobsService        = $jobsService;        $this->categoryRepository = $categoryRepository;    }    public function index(Request $request)    {        $where = [            ['is_health', '=', 1],        ];        $list             = Company::where($where)->orderBy('sort_index','asc')->get();        $other_categories = $this->categoryRepository->getCategories();        $tag_category     = array_get($other_categories, 'AIX_jobtag');        foreach ($list as $v) {            $tag_arr = [];            if (!empty($v->tag)) {                foreach ($v->tag as $t) {                    $tag_arr[] = array_get($tag_category, $t);                }            }            $v->tag_arr   = $tag_arr;            $v->job_count = Jobs::where([                ['company_id', '=', $v->id],                ['valid', '=', 1],                ['display', '=', 1],                ['audit', '=', '1'],            ])->count();        }        return view('mobile.app.health.hospital.index', ['list' => $list]);    }    public function show(Request $request)    {        //获取企业信息        $company_id   = $request->input('id');        $company_info = $this->companyService->getCompanyInfo([['id', '=', $company_id]]);//        dd($company_info);        $this->putSeoData('company', $company_info);        //在招职位        $jobs_where   = [            ['company_id', '=', $company_info->id],            ['valid', '=', 1],            ['display', '=', 1],        ];        $jobs_display = config('aix.companyset.comset.show_set.jobs_display');        if ($jobs_display == 1) {            $jobs_where[] = ['audit', '=', '1'];        } else {            $jobs_where[] = ['audit', '<>', '3'];        }        $jobs = $this->jobsService->getOtherJobs($jobs_where);        $return_data = [            'info' => $company_info,            'jobs' => $jobs,        ];        return view('mobile.app.health.hospital.show', $return_data);    }}
 |