-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelpers.php
45 lines (42 loc) · 1004 Bytes
/
helpers.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
/**
* A simple function which
* demonstrated working of
* helpers which returns
* simple string blade
* file name
* @return String Name of the Blade File
*/
function sayHello()
{
return "index";
}
/**
* This function returns the Application URL
* for the given folder location
* @param String $location Folder Location
* @return String Folder URL
*/
function baseUrl($location)
{
$url = (isset($_SERVER['HTTPS'])) ? 'https://' : 'http://';
$url .= $_SERVER['HTTP_HOST'];
return $url.$location;
}
/**
* This function is simply like an alias
* to getenv function
* https://github.com/vlucas/phpdotenv
*
* @param String $veriable_name ENV Variable you want to select
* @param String $default_value Default value if the veriable not found
* @return String Value of variable from .env file
*/
function env($variable_name, $default_value)
{
$return_value = getenv($variable_name);
if ($return_value) {
return $return_value;
}
return $default_value;
}