2016-10-25 7 views
0

html 빌더에서 설정되지 않은 보안 프로토콜 https에 대해 Laravel4.2에서 url 또는 base URL을 구성하는 방법.laravel4.2의 보안 프로토콜 (https) 용 html 빌더 구성 방법

{{ HTML::style('front_assets/plugins/bootstrap/css/bootstrap.min.css') }} 
     {{ HTML::style('front_assets/css/style.css')}} 
     <!-- CSS Implementing Plugins --> 

     {{ HTML::style('front_assets/plugins/font-awesome/css/font-awesome.min.css') }} 
     {{ HTML::style('front_assets/plugins/sky-forms/version-2.0.1/css/custom-sky-forms.css') }} 

     {{ HTML::style('front_assets/plugins/scrollbar/src/perfect-scrollbar.css') }} 
     {{ HTML::style('front_assets/plugins/fullcalendar/fullcalendar.css') }} 
     {{ HTML::style('front_assets/plugins/fullcalendar/fullcalendar.print.css',array('media' => 'print')) }} 

답변

0

필요한 항목이 명확하지 않습니다. 페이지 URL이 https 구성표 인 경우 해당 페이지의 모든 애셋 URL은 https로 자동 생성되지만 http가 요청한 페이지에서 https로 연결될 특정 유형의 애셋 만 필요하면 사용자 정의 HtmlBuilder을 구현해야합니다 그 헬퍼 메소드는 HTTPS에게 그런 app.php 설정 당신이 사용자 정의 MyAppHtmlServiceProvider와 기본 HtmlServiceProvider를 교체해야하는 URL

<?php namespace MyApp\Html; 

use Illuminate\Html\HtmlBuilder; 

class MyAppHtmlBuilder extends HtmlBuilder { 

    public function style($url, $attributes = array(), $secure = true) 
    {               ^^^^ 
     return parent::style($url, $attributes, $secure) 
    } 
} 

을 생성하도록 강제 할 필요가 우선합니다.

<?php namespace MyApp\Html; 

use Illuminate\Html\HtmlServiceProvider; 
use MyApp\Html\MyAppHtmlBuilder; 

class MyAppHtmlServiceProvider extends HtmlServiceProvider { 

    protected function registerHtmlBuilder() 
    { 
     $this->app->bindShared('html', function($app) 
     { 
      return new MyAppHtmlBuilder($app['url']); 
     }); 
    } 
}