navigationService = $navigationService; } /** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { if (!str_contains($request->route()->getPrefix(), 'admin')) { $page_seo = $this->navigationService->getSeo($request->route()); if (!$page_seo) { $page_seo = $this->getCustomPageSeo($request->route()->getName()); } View::share('page_seo', $page_seo); } return $next($request); } private function getCustomPageSeo($url_name) { $custom_arr = array( 'person.*' => array( 'title' => '个人会员中心-{#site_name}', 'keywords' => '', 'description' => '' ), //个人中心 'com.*' => array( 'title' => '企业会员中心-{#site_name}', 'keywords' => '', 'description' => '' ), //企业中心 'service.*'=>array( 'title' => '企业会员中心-{#site_name}', 'keywords' => '', 'description' => '' ),//企业中心======》会员套餐 'jobs.*'=>array( 'title' => '企业会员中心-{#site_name}', 'keywords' => '', 'description' => '' ),//企业中心======》职位管理 'resume.*'=>array( 'title' => '企业会员中心-{#site_name}', 'keywords' => '', 'description' => '' ),//企业中心======》简历管理 'jobfair.*'=>array( 'title' => '企业会员中心-{#site_name}', 'keywords' => '', 'description' => '' ),//企业中心======》招聘会管理 'help.search' => array( 'title' => '帮助-{#site_name}', 'keywords' => '', 'description' => '' ), 'register.*' => array( 'title' => '会员注册-{#site_name}', 'keywords' => '', 'description' => '' ), //注册 'login.*' => array( 'title' => '会员登录-{#site_name}', 'keywords' => '', 'description' => '' ), //登陆 'password.request' => array( 'title' => '忘记密码-{#site_name}', 'keywords' => '', 'description' => '' ), //忘记密码 'password.reset' => array( 'title' => '重置密码-{#site_name}', 'keywords' => '', 'description' => '' ), //重置密码 ); foreach ($custom_arr as $key => $value) { if (strpos($key, '*')!==false) { $key=str_replace('*', '', $key); if (strpos($url_name, $key)!==false) { return $value; } } else { if ($key == $url_name) { return $value; } } } return false; } }