HrtoolsController.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace App\Http\Controllers\Web\Content;
  3. use App\Exceptions\ResponseException;
  4. use App\Http\Controllers\Web\WebBaseController;
  5. use App\Services\Content\HrtoolsService;
  6. use App\Services\Content\HrtoolsCategoryService;
  7. class HrtoolsController extends WebBaseController
  8. {
  9. protected $hrtoolsService;
  10. protected $hrtoolsCategoryService;
  11. /**
  12. * HrtoolsController constructor.
  13. * @param $hrtoolsService
  14. */
  15. public function __construct(HrtoolsService $hrtoolsService, HrtoolsCategoryService $hrtoolsCategoryService)
  16. {
  17. $this->hrtoolsService = $hrtoolsService;
  18. $this->hrtoolsCategoryService = $hrtoolsCategoryService;
  19. }
  20. public function index()
  21. {
  22. $return_data = array();
  23. $hrtools_categories = $this->hrtoolsCategoryService->lists();
  24. $return_data = array(
  25. 'hrtools_categories' => $hrtools_categories
  26. );
  27. return view('app.content.hrtools.index', $return_data);
  28. }
  29. public function list($id)
  30. {
  31. $hrtools_category = $this->hrtoolsCategoryService->lists(array('id'=>$id));
  32. $lists = $this->hrtoolsService->getHrtools(array('type_id'=>(int)$id));
  33. $return_data = array(
  34. 'infos' => $lists,
  35. 'hrtools_category' =>$hrtools_category
  36. );
  37. $this->putSeoData('hrtools_category', $hrtools_category);
  38. return view('app.content.hrtools.list', $return_data);
  39. }
  40. }