Completed
Pull Request — master (#12)
by ARCANEDEV
14:58 queued 04:03
created

helpers.php ➔ link_to_action()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 2
b 0
f 0
nc 1
nop 5
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(\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 \Illuminate\Support\HtmlString
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 \Illuminate\Support\HtmlString
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 \Illuminate\Support\HtmlString
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 \Illuminate\Support\HtmlString
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