forked from shnhrrsn/laravel-assets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathServiceProvider.php
29 lines (21 loc) · 983 Bytes
/
ServiceProvider.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
<?php namespace Assets;
class ServiceProvider extends \Illuminate\Support\ServiceProvider {
public function register() {
}
public function boot() {
if($this->app->resolved('router') || $this->app->bound('router')) {
$router = $this->app['router'];
$router->get('assets/img/{a?}/{b?}/{c?}/{d?}/{e?}', '\Assets\Http\Controller@img');
$router->get('assets/font/{a?}/{b?}/{c?}/{d?}/{e?}', '\Assets\Http\Controller@font');
$router->get('assets/fonts/{a?}/{b?}/{c?}/{d?}/{e?}', '\Assets\Http\Controller@font');
$router->get('assets/css/{a?}/{b?}/{c?}/{d?}/{e?}', '\Assets\Http\Controller@css');
$router->get('assets/{type}/{a?}/{b?}/{c?}/{d?}/{e?}', '\Assets\Http\Controller@compile');
}
$this->commands('\Assets\Console\PublishCommand', '\Assets\Console\UnpublishCommand');
if(class_exists('\Illuminate\Html\HtmlBuilder')) {
\Illuminate\Html\HtmlBuilder::macro('assetPath', function($path) {
return Asset::publishedPath($path);
});
}
}
}