Issues (32)

src/ViewComposers/SidebarComposer.php (1 issue)

Labels
Severity
1
<?php namespace Arcanesoft\Foundation\ViewComposers;
2
3
use Arcanesoft\Sidebar\Contracts\Manager as SidebarManager;
4
use Illuminate\Support\Arr;
5
use Illuminate\View\View;
0 ignored issues
show
The type Illuminate\View\View was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
7
/**
8
 * Class     SidebarComposer
9
 *
10
 * @package  Arcanesoft\Foundation\ViewComposers
11
 * @author   ARCANEDEV <[email protected]>
12
 */
13
class SidebarComposer
14
{
15
    /* -----------------------------------------------------------------
16
     |  Constants
17
     | -----------------------------------------------------------------
18
     */
19
20
    const VIEW = 'foundation::admin._template.sidebar-main';
21
22
    /* -----------------------------------------------------------------
23
     |  Properties
24
     | -----------------------------------------------------------------
25
     */
26
27
    /**
28
     * The Sidebar instance.
29
     *
30
     * @var \Arcanesoft\Sidebar\Contracts\Manager
31
     */
32
    protected $sidebar;
33
34
    /* -----------------------------------------------------------------
35
     |  Constructor
36
     | -----------------------------------------------------------------
37
     */
38
39
    /**
40
     * SidebarComposer constructor.
41
     *
42
     * @param  \Arcanesoft\Sidebar\Contracts\Manager  $sidebar
43
     */
44
    public function __construct(SidebarManager $sidebar)
45
    {
46
        $this->sidebar = $sidebar;
47
    }
48
49
    /* -----------------------------------------------------------------
50
     |  Main Methods
51
     | -----------------------------------------------------------------
52
     */
53
54
    /**
55
     * Bind data to the view.
56
     *
57
     * @param  \Illuminate\View\View  $view
58
     */
59
    public function compose(View $view)
60
    {
61
        $this->sidebar->loadItemsFromConfig('arcanesoft.foundation.sidebar.items');
62
        $this->sidebar->setCurrent(
63
            Arr::get($view->getData(), 'current_page', '')
64
        );
65
    }
66
}
67