| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 | 
							- <?php
 
- namespace App\Http\Middleware;
 
- use View;
 
- use App\Services\Content\NavigationService;
 
- use Closure;
 
- class GetSeoInfo
 
- {
 
-     protected $navigationService;
 
-     /**
 
-      * GetSeoInfo constructor.
 
-      * @param NavigationService $navigationService
 
-      */
 
-     public function __construct(NavigationService $navigationService)
 
-     {
 
-         $this->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;
 
-     }
 
- }
 
 
  |