1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Thinktomorrow\Chief\App\Providers; |
4
|
|
|
|
5
|
|
|
use Illuminate\Support\Facades\Blade; |
6
|
|
|
use Illuminate\Support\Facades\View; |
7
|
|
|
use Illuminate\Support\ServiceProvider; |
8
|
|
|
use Livewire\Livewire; |
9
|
|
|
use Thinktomorrow\Chief\App\View\Livewire\FieldsWindow; |
|
|
|
|
10
|
|
|
use Thinktomorrow\Chief\App\View\Livewire\Fragments; |
11
|
|
|
use Thinktomorrow\Chief\App\View\Livewire\Links; |
|
|
|
|
12
|
|
|
use Thinktomorrow\Chief\App\View\Livewire\Status; |
|
|
|
|
13
|
|
|
use Thinktomorrow\Chief\Site\Urls\UrlHelper; |
14
|
|
|
|
15
|
|
|
class ViewServiceProvider extends ServiceProvider |
16
|
|
|
{ |
17
|
|
|
protected $defer = false; |
18
|
|
|
|
19
|
|
|
public function boot(): void |
20
|
|
|
{ |
21
|
|
|
$this->app['view']->addNamespace('chief-fragments', __DIR__ . '/../../src/Fragments/resources'); |
22
|
|
|
|
23
|
|
|
View::composer([ |
24
|
|
|
'chief::manager._transitions.modals.archive-modal', |
25
|
|
|
], function ($view) { |
26
|
|
|
$viewData = $view->getData(); |
27
|
|
|
|
28
|
|
|
$ignoredModel = (isset($viewData['model'])) |
29
|
|
|
? $viewData['model'] |
30
|
|
|
: null; |
31
|
|
|
|
32
|
|
|
$onlineModels = UrlHelper::allOnlineModels(false, $ignoredModel); |
33
|
|
|
|
34
|
|
|
$view->with('targetModels', $onlineModels); |
35
|
|
|
}); |
36
|
|
|
|
37
|
|
|
Blade::componentNamespace('Thinktomorrow\\Chief\\App\\View\\Components', 'chief'); |
38
|
|
|
|
39
|
|
|
// Livewire components |
40
|
|
|
// Livewire::component('fragments', Fragments::class); |
41
|
|
|
// Livewire::component('links', Links::class); |
42
|
|
|
// Livewire::component('fields-window', FieldsWindow::class); |
43
|
|
|
// Livewire::component('status', Status::class); |
44
|
|
|
|
45
|
|
|
/* Livewire component wrappers */ |
46
|
|
|
// Blade::component('chief-fragments::window', 'chief-fragments::window'); |
47
|
|
|
// Blade::component('chief::manager.windows.fields.window', 'chief::window.fields'); |
48
|
|
|
Blade::component('chief::manager.windows.fields.window', 'chief::window.fields'); |
49
|
|
|
Blade::component('chief::manager.windows.status.window', 'chief::window.status'); |
50
|
|
|
Blade::component('chief::manager.windows.links.window', 'chief::window.links'); |
51
|
|
|
|
52
|
|
|
/* Chief components */ |
53
|
|
|
Blade::component('chief::components.window', 'chief::window'); |
54
|
|
|
Blade::component('chief::components.title', 'chief-title'); |
55
|
|
|
Blade::component('chief::components.content', 'chief-content'); |
56
|
|
|
Blade::component('chief::components.card', 'chief-card'); |
57
|
|
|
Blade::component('chief::components.sidebar', 'chief-sidebar'); |
58
|
|
|
Blade::component('chief::components.inline-notification', 'chief-inline-notification'); |
59
|
|
|
Blade::component('chief::components.icon-label', 'chief-icon-label'); |
60
|
|
|
Blade::component('chief::components.icon-button', 'chief-icon-button'); |
61
|
|
|
Blade::component('chief::components.hierarchy', 'chief-hierarchy'); |
62
|
|
|
|
63
|
|
|
/* Wireframe components */ |
64
|
|
|
Blade::component('chief::wireframes.wireframe', 'wireframe'); |
65
|
|
|
Blade::component('chief::wireframes.container', 'wireframe-container'); |
66
|
|
|
Blade::component('chief::wireframes.row', 'wireframe-row'); |
67
|
|
|
Blade::component('chief::wireframes.column', 'wireframe-column'); |
68
|
|
|
Blade::component('chief::wireframes.title', 'wireframe-title'); |
69
|
|
|
Blade::component('chief::wireframes.text', 'wireframe-text'); |
70
|
|
|
Blade::component('chief::wireframes.image', 'wireframe-image'); |
71
|
|
|
Blade::component('chief::wireframes.video', 'wireframe-video'); |
72
|
|
|
Blade::component('chief::wireframes.rect', 'wireframe-rect'); |
73
|
|
|
|
74
|
|
|
/* Chief directives */ |
75
|
|
|
Blade::directive('fragments', function () { |
76
|
|
|
return "<?php echo app(\Thinktomorrow\Chief\Fragments\FragmentsRenderer::class)->render(\$model, get_defined_vars()); ?>"; |
77
|
|
|
}); |
78
|
|
|
Blade::directive('adminConfig', function ($expression = null) { |
79
|
|
|
if ($expression) { |
80
|
|
|
$method = "get".ucfirst(str_replace("'", '', $expression)); |
81
|
|
|
|
82
|
|
|
return "<?php echo \$model->adminConfig()->$method(); ?>"; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
return "<?php echo \$model->adminConfig(); ?>"; |
86
|
|
|
}); |
87
|
|
|
Blade::directive('adminRoute', function ($expression) { |
88
|
|
|
return "<?php echo \$manager->route($expression); ?>"; |
89
|
|
|
}); |
90
|
|
|
Blade::directive('adminCan', function ($expression) { |
91
|
|
|
return "<?php if (\$manager->can($expression)) { ?>"; |
92
|
|
|
}); |
93
|
|
|
Blade::directive('elseAdminCan', function () { |
94
|
|
|
return "<?php } else { ?>"; |
95
|
|
|
}); |
96
|
|
|
Blade::directive('endAdminCan', function () { |
97
|
|
|
return "<?php } ?>"; |
98
|
|
|
}); |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
public function register() |
102
|
|
|
{ |
103
|
|
|
// |
104
|
|
|
} |
105
|
|
|
} |
106
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths