63 lines
2.2 KiB
PHP
63 lines
2.2 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use Illuminate\Support\Facades\Blade;
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
// @deprecated - now using pa()
|
|
class CustomBladeServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Register services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function register()
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Bootstrap services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function boot()
|
|
{
|
|
Blade::directive('css',function($expression) {
|
|
switch (trim($expression,"'")) {
|
|
case 'datatables':
|
|
return
|
|
'<link type="text/css" rel="stylesheet" href="https://cdn.datatables.net/1.10.25/css/dataTables.bootstrap5.min.css" media="screen">'.
|
|
'<link type="text/css" rel="stylesheet" href="'.asset('plugin/dataTables/dataTables.bootstrap5.css').'" media="screen">';
|
|
|
|
default:
|
|
throw new \Exception('Unknown CSS: '.$expression);
|
|
}
|
|
});
|
|
|
|
Blade::directive('js',function($expression) {
|
|
switch (trim($expression,"'")) {
|
|
case 'datatables':
|
|
return
|
|
'<script type="text/javascript" src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.min.js"></script>'.
|
|
'<script type="text/javascript" src="'.asset('plugin/dataTables/dataTables.conditionalPaging.js').'"></script>'.
|
|
'<script type="text/javascript" src="https://cdn.datatables.net/rowgroup/1.1.2/js/dataTables.rowGroup.min.js"></script>'.
|
|
'<script type="text/javascript" src="https://cdn.datatables.net/1.10.25/js/dataTables.bootstrap5.min.js"></script>';
|
|
|
|
case 'highcharts':
|
|
return
|
|
'<script type="text/javascript" src="https://code.highcharts.com/highcharts.js"></script>'.
|
|
'<script type="text/javascript" src="https://code.highcharts.com/modules/data.js"></script>'.
|
|
'<script type="text/javascript" src="https://code.highcharts.com/modules/drilldown.js"></script>'.
|
|
'<script type="text/javascript" src="https://code.highcharts.com/modules/exporting.js"></script>'.
|
|
'<script type="text/javascript" src="https://code.highcharts.com/modules/export-data.js"></script>'.
|
|
'<script type="text/javascript" src="https://code.highcharts.com/themes/dark-unica.js"></script>';
|
|
|
|
default:
|
|
throw new \Exception('Unknown JS: '.$expression);
|
|
}
|
|
});
|
|
}
|
|
} |