ComposerServiceProvider.php
1.38 KB
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
46
47
48
49
50
51
52
53
54
55
<?php
namespace App\Providers;
use App\Models\Area;
use App\Models\Contact;
use App\Models\format_area;
use App\Models\Tag;
use App\Models\type_area;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\View;
class ComposerServiceProvider extends ServiceProvider
{
/**
* Register services.
*
* @return void
*/
public function register()
{
$views = ['part.filter.main','part.filter.catalog', 'part.filter.category', 'part.filter.mapsobj'];
View::composer($views,
function($view) {
$items_type_area = type_area::all();
$items_format_area = format_area::all();
$items_area = Area::all();
$view->with([
'items_area' => $items_area,
'items_type_area' => $items_type_area,
'items_format_area' => $items_format_area,
]);
}
);
$views = ['layout.site', 'index', 'about', 'house.post', 'catalog', 'category_catalog',
'catalogs.elemhouse', 'catalogs.house_mini'];
View::composer($views, function($view) {
$view->with(['items_contact' => Contact::limit(1)->get()]);
});
}
/**
* Bootstrap services.
*
* @return void
*/
public function boot()
{
//
}
}