1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
if (!function_exists('manager_flash')) { |
4
|
|
|
/** |
5
|
|
|
* Flash a message to the session. |
6
|
|
|
* |
7
|
|
|
* @param string $title Flash message title. |
8
|
|
|
* @param string $message Flash message body. |
9
|
|
|
* |
10
|
|
|
* @return mixed |
11
|
|
|
*/ |
12
|
|
|
function manager_flash($title = null, $message = null) |
13
|
|
|
{ |
14
|
|
|
$flash = app('Larafolio\Http\Flash'); |
15
|
|
|
|
16
|
|
|
if (func_num_args() == 0) { |
17
|
|
|
return $flash; |
18
|
|
|
} |
19
|
|
|
|
20
|
|
|
return $flash->message($title, $message); |
21
|
|
|
} |
22
|
|
|
} |
23
|
|
|
|
24
|
|
|
if (!function_exists('manager_cache_bust')) { |
25
|
|
|
/** |
26
|
|
|
* Return the versioned asset file for given file. |
27
|
|
|
* |
28
|
|
|
* @param string $path Unversioned file path. |
29
|
|
|
* @param string $jsonData Json object. |
30
|
|
|
* @param string $root Location of files in /public. |
31
|
|
|
* |
32
|
|
|
* @return string |
33
|
|
|
*/ |
34
|
|
|
function manager_cache_bust($path, $jsonData = null, $root = 'vendor/larafolio/') |
35
|
|
|
{ |
36
|
|
|
$path = trim($path, '/'); |
37
|
|
|
|
38
|
|
|
$file = str_replace($root, '', $path); |
39
|
|
|
|
40
|
|
|
if ($jsonData === null && file_exists(public_path($root.'rev-manifest.json'))) { |
41
|
|
|
$jsonData = file_get_contents(public_path($root.'rev-manifest.json')); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
if ($jsonData !== null) { |
45
|
|
|
$data = json_decode($jsonData, true); |
46
|
|
|
|
47
|
|
|
if (array_key_exists($file, $data)) { |
48
|
|
|
return '/'.$root.$data[$file]; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
return elixir($path); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
abort(500, "Resource {$path} could not be resolved."); |
55
|
|
|
} |
56
|
|
|
} |
57
|
|
|
|