<?php
namespace App\Http\Controllers\Web\Content;

use App\Exceptions\ResponseException;
use App\Http\Controllers\Web\WebBaseController;
use App\Services\Content\HrtoolsService;
use App\Services\Content\HrtoolsCategoryService;


class HrtoolsController extends WebBaseController
{
    protected $hrtoolsService;
    protected $hrtoolsCategoryService;

    /**
     * HrtoolsController constructor.
     * @param $hrtoolsService
     */
    public function __construct(HrtoolsService $hrtoolsService, HrtoolsCategoryService $hrtoolsCategoryService)
    {
        $this->hrtoolsService = $hrtoolsService;
        $this->hrtoolsCategoryService = $hrtoolsCategoryService;
    }
    public function index()
    {
        $return_data = array();
        $hrtools_categories = $this->hrtoolsCategoryService->lists();
        $return_data = array(
            'hrtools_categories' => $hrtools_categories
        );
        return view('app.content.hrtools.index', $return_data);
    }
    public function list($id)
    {
        $hrtools_category = $this->hrtoolsCategoryService->lists(array('id'=>$id));
        $lists = $this->hrtoolsService->getHrtools(array('type_id'=>(int)$id));
        $return_data = array(
            'infos' => $lists,
            'hrtools_category' =>$hrtools_category
        );
        $this->putSeoData('hrtools_category', $hrtools_category);
        return view('app.content.hrtools.list', $return_data);
    }

}