1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
if ( ! function_exists('html')) { |
4
|
|
|
/** |
5
|
|
|
* Get the HTML Builder instance. |
6
|
|
|
* |
7
|
|
|
* @return \Arcanedev\LaravelHtml\Contracts\HtmlBuilderInterface |
8
|
|
|
*/ |
9
|
|
|
function html() |
10
|
|
|
{ |
11
|
|
|
return app(\Arcanedev\LaravelHtml\Contracts\HtmlBuilderInterface::class); |
12
|
|
|
} |
13
|
|
|
} |
14
|
|
|
|
15
|
|
|
/* ------------------------------------------------------------------------------------------------ |
16
|
|
|
| Link Helpers |
17
|
|
|
| ------------------------------------------------------------------------------------------------ |
18
|
|
|
*/ |
19
|
|
|
if ( ! function_exists('link_to')) { |
20
|
|
|
/** |
21
|
|
|
* Generate a HTML link. |
22
|
|
|
* |
23
|
|
|
* @param string $url |
24
|
|
|
* @param string $title |
25
|
|
|
* @param array $attributes |
26
|
|
|
* @param bool $secure |
27
|
|
|
* @param bool $escaped |
28
|
|
|
* |
29
|
|
|
* @return string |
30
|
|
|
*/ |
31
|
|
|
function link_to($url, $title = null, $attributes = [], $secure = null, $escaped = true) |
|
|
|
|
32
|
|
|
{ |
33
|
|
|
return html()->link($url, $title, $attributes, $secure, $escaped); |
34
|
|
|
} |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
if ( ! function_exists('link_to_asset')) { |
38
|
|
|
/** |
39
|
|
|
* Generate a HTML link to an asset. |
40
|
|
|
* |
41
|
|
|
* @param string $url |
42
|
|
|
* @param string $title |
43
|
|
|
* @param array $attributes |
44
|
|
|
* @param bool $secure |
45
|
|
|
* |
46
|
|
|
* @return string |
47
|
|
|
*/ |
48
|
|
|
function link_to_asset($url, $title = null, $attributes = [], $secure = null) |
49
|
|
|
{ |
50
|
|
|
return html()->linkAsset($url, $title, $attributes, $secure); |
51
|
|
|
} |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
if ( ! function_exists('link_to_route')) { |
55
|
|
|
/** |
56
|
|
|
* Generate a HTML link to a named route. |
57
|
|
|
* |
58
|
|
|
* @param string $name |
59
|
|
|
* @param string $title |
60
|
|
|
* @param array $params |
61
|
|
|
* @param array $attributes |
62
|
|
|
* @param bool $escaped |
63
|
|
|
* |
64
|
|
|
* @return string |
65
|
|
|
*/ |
66
|
|
|
function link_to_route($name, $title = null, $params = [], $attributes = [], $escaped = true) |
67
|
|
|
{ |
68
|
|
|
return html()->linkRoute($name, $title, $params, $attributes, $escaped); |
69
|
|
|
} |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
if ( ! function_exists('link_to_action')) { |
73
|
|
|
/** |
74
|
|
|
* Generate a HTML link to a controller action. |
75
|
|
|
* |
76
|
|
|
* @param string $action |
77
|
|
|
* @param string $title |
78
|
|
|
* @param array $params |
79
|
|
|
* @param array $attributes |
80
|
|
|
* @param bool $escaped |
81
|
|
|
* |
82
|
|
|
* @return string |
83
|
|
|
*/ |
84
|
|
|
function link_to_action($action, $title = null, $params = [], $attributes = [], $escaped = true) |
85
|
|
|
{ |
86
|
|
|
return html()->linkAction($action, $title, $params, $attributes, $escaped); |
87
|
|
|
} |
88
|
|
|
} |
89
|
|
|
|
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.