@@ -34,6 +34,10 @@ public function __construct(UrlGenerator $urlGenerator)
3434 */
3535 public function script ($ url , $ attributes = [], $ secure = null )
3636 {
37+ if (!$ url ) {
38+ return null ;
39+ }
40+
3741 $ attributes ['src ' ] = $ this ->url ->asset ($ url , $ secure );
3842
3943 return $ this ->toHtmlString ('<script ' . $ this ->attributes ($ attributes ) . '></script> ' );
@@ -50,6 +54,10 @@ public function script($url, $attributes = [], $secure = null)
5054 */
5155 public function style ($ url , $ attributes = [], $ secure = null )
5256 {
57+ if (!$ url ) {
58+ return null ;
59+ }
60+
5361 $ defaults = [
5462 'media ' => 'all ' ,
5563 'type ' => 'text/css ' ,
@@ -63,18 +71,6 @@ public function style($url, $attributes = [], $secure = null)
6371 return $ this ->toHtmlString ('<link ' . $ this ->attributes ($ attributes ) . '> ' );
6472 }
6573
66- /**
67- * Transform the string to an Html serializable object.
68- *
69- * @param $html
70- *
71- * @return \Illuminate\Support\HtmlString
72- */
73- protected function toHtmlString ($ html )
74- {
75- return new HtmlString ($ html );
76- }
77-
7874 /**
7975 * Build an HTML attribute string from an array.
8076 *
@@ -99,6 +95,18 @@ public function attributes($attributes)
9995 return count ($ html ) > 0 ? ' ' . implode (' ' , $ html ) : '' ;
10096 }
10197
98+ /**
99+ * Transform the string to an Html serializable object.
100+ *
101+ * @param $html
102+ *
103+ * @return \Illuminate\Support\HtmlString
104+ */
105+ protected function toHtmlString ($ html )
106+ {
107+ return new HtmlString ($ html );
108+ }
109+
102110 /**
103111 * Build a single attribute element.
104112 *
0 commit comments