Completed
Pull Request — master (#7)
by ARCANEDEV
06:27
created

helpers.php ➔ html()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
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('html');
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
     *
28
     * @return string
29
     */
30
    function link_to($url, $title = null, $attributes = [], $secure = null)
31
    {
32
        return html()->link($url, $title, $attributes, $secure);
33
    }
34
}
35
36
if ( ! function_exists('link_to_asset')) {
37
    /**
38
     * Generate a HTML link to an asset.
39
     *
40
     * @param  string  $url
41
     * @param  string  $title
42
     * @param  array   $attributes
43
     * @param  bool    $secure
44
     *
45
     * @return string
46
     */
47
    function link_to_asset($url, $title = null, $attributes = [], $secure = null)
48
    {
49
        return html()->linkAsset($url, $title, $attributes, $secure);
50
    }
51
}
52
53
if ( ! function_exists('link_to_route')) {
54
    /**
55
     * Generate a HTML link to a named route.
56
     *
57
     * @param  string  $name
58
     * @param  string  $title
59
     * @param  array   $params
60
     * @param  array   $attributes
61
     *
62
     * @return string
63
     */
64
    function link_to_route($name, $title = null, $params = [], $attributes = [])
65
    {
66
        return html()->linkRoute($name, $title, $params, $attributes);
67
    }
68
}
69
70
if ( ! function_exists('link_to_action')) {
71
    /**
72
     * Generate a HTML link to a controller action.
73
     *
74
     * @param  string  $action
75
     * @param  string  $title
76
     * @param  array   $params
77
     * @param  array   $attributes
78
     * @param  bool    $escaped
79
     *
80
     * @return string
81
     */
82
    function link_to_action($action, $title = null, $params = [], $attributes = [], $escaped = true)
83
    {
84
        return html()->linkAction($action, $title, $params, $attributes, $escaped);
85
    }
86
}
87