Completed
Push — master ( 7c898f...6cdc89 )
by Arjay
11:45
created

helper.php ➔ datatable()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 1
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
use Yajra\DataTables\Factory;
4
5
if (!function_exists('config_path')) {
6
    /**
7
     * Get the configuration path.
8
     *
9
     * @param  string $path
10
     * @return string
11
     */
12
    function config_path($path = '')
13
    {
14
        return app()->basePath() . '/config' . ($path ? '/' . $path : $path);
15
    }
16
}
17
18
if (!function_exists('public_path')) {
19
    /**
20
     * Return the path to public dir
21
     *
22
     * @param null $path
23
     * @return string
24
     */
25
    function public_path($path = null)
26
    {
27
        return rtrim(app()->basePath('public/' . $path), '/');
28
    }
29
}
30
31
if (!function_exists('datatable')) {
32
    /**
33
     * Helper to make a new DataTable instance from source.
34
     * Or return a new factory is source is not set.
35
     *
36
     * @param mixed $source
37
     * @return \Yajra\DataTables\DataTableAbstract|\Yajra\DataTables\Factory
38
     */
39
    function datatable($source = null)
40
    {
41
        if ($source) {
42
            return Factory::make($source);
43
        }
44
45
        return new Factory;
46
    }
47
}
48