Add view composer.

@param  string|array<string> $views
@param  string|Closure       $composer
@return void
965295
public function addComposer( $views, $composer ) {
		$views = array_map( function ( $view ) {
			return ViewEngine::canonical( $view );
		}, MixedType::toArray( $views ) );

		$handler = new Handler( $composer, 'compose', '\\App\\ViewComposers\\' );

		$this->composers[] = [
			'views' => $views,
			'composer' => $handler,
		];
	}
764348
public function add($view, RuleCollection $collection)
    {
        $name = FormHelper::getFormName($view);
        if (isset($this->rules[$name])) {
            $this->rules[$name]->addCollection($collection);
        } else {
            $this->rules[$name] = $collection;
        }
    }
711892
public function view(string $view, array $data = [])
  {
    $path = $this->viewsDirectory . $this->DS . $this->cleanPath($view) . $this->viewsExtension;
    $this->verify($path);
    $this->registerDirectives();

    $compiler = new Compiler($this->cacheDirectory, $this->viewsDirectory, $this->viewsExtension, $this->directives, $this->engine);
    $compiler->makeView($path, $data);
    return $this;
  }
577453
public function compose(View $view)
    {
        $view->withComponentCount($this->componentCount);
        $view->withIncidentCount($this->incidentCount);
        $view->withIncidentTemplateCount($this->incidentTemplateCount);
        $view->withScheduleCount($this->scheduleCount);
        $view->withSubscriberCount($this->subscriberCount);
        $view->withIsWriteable(is_writable(app()->bootstrapPath().'/cachet'));
    }
1252
public function compose(View $view)
    {
        $displayMetrics = $this->config->get('setting.display_graphs');
        $metrics = $this->getVisibleMetrics($displayMetrics);

        $view->withDisplayMetrics($displayMetrics)
            ->withMetrics($metrics);
    }
1367522
public function compose(View $view)
    {
        /**
         * @var  \Carbon\Carbon                  $start
         * @var  \Carbon\Carbon                  $end
         * @var  \Illuminate\Support\Collection  $range
         */
        extract(DateRange::getCurrentMonthDaysRange());

        $view->with('authenticatedVisitorsRatio', $this->getAuthenticatedVisitorsRatio(
            $this->getVisitorsFilteredByDateRange($start, $end)
        ));
    }
1347516
public function compose(View $view)
    {
        $countries = Country::all();
        $options = Collection::make();
        foreach ($countries as $country) {
            $options->put($country->currency_code,['id' => $country->currency_code,'name' => $country->currency_code] );
        }
        $statusOptions = Collection::make([['id' => 'ENABLED','name' => 'Enabled'],['id' => 'DISABLED','name' => 'Disabled']]);
       
        $view->with('codeOptions', $options)
                    ->with('statusOptions',$statusOptions);
    }
611898
public function registerViewComposers(): void
    {
        view()->composer('admin.module.rating::back.partials.analytics.statistic', function ($view) {
            $ratings = RatingModel::select(['rating', DB::raw('count(*) as total')])->groupBy('rating')->get();

            $view->with('ratings', $ratings);
        });
    }
999908
public function composeFilters(View $view)
    {
        $roles   = $this->cacheResults('roles.filters', function () {
            return $this->role->has('users')->get();
        });

        $filters = new Collection;
        $filters->push(link_to_route('admin::auth.users.index', trans('core::generals.all')));

        foreach ($roles as $role) {
            /** @var  \Arcanesoft\Auth\Models\Role  $role */
            $filters->push(link_to_route('admin::auth.users.roles-filter.index', $role->name, [$role->hashed_id]));
        }

        $view->with('rolesFilters', $filters);
    }
526452
protected function compileViews(Collection $views)
    {
        $compiler = $this->laravel['view']->getEngineResolver()->resolve('blade')->getCompiler();

        $views->map(function (SplFileInfo $file) use ($compiler) {
            $compiler->compile($file->getRealPath());
        });
    }
262011
public function compose(View $view)
    {
        $view->withCacheDrivers($this->cacheDrivers);
        $view->withMailDrivers($this->mailDrivers);
        $view->withQueueDrivers($this->queueDrivers);
    }
1142981
public function addPackageFromComposerFiles($composers)
    {
        settype($composers, 'array');
        foreach($composers as $file)
        {
            $data = (array)json_decode(file_get_contents($file));

            if (isset($data['type']) && $data['type'] == 'anahita-extension') {
                if (!isset($data['extension-source'])) {
                    $data['extension-source'] = 'src';
                }

                $data['extension-source'] = realpath(dirname($file).'/src');

                if (is_readable($data['extension-source'])) {
                    $parts = array_filter(explode('/', @$data['name']));
                    $name = strtolower(pick(@$parts[1], basename(dirname($file))));
                    $vendor = strtolower(pick(@$parts[0], $name));
                    $this[] = new Package(array(
                        'composer_file' => $file,
                        'name' => $name,
                        'vendor' => $vendor,
                        'source' => $data['extension-source']
                    ));
                }
            }
        }
    }
1350950
public function addView(View $view)
    {
        if ($this->hasView($view->getName())) {
            throw SchemaException::schemaViewAlreadyExists($this->getName(), $view->getName());
        }

        $this->views[$view->getName()] = $view;
    }
232503
public function compose(View $view)
    {
        $categoryOptions = Category::getCategoryOptions();
        $storageOptions = []; //Storage::pluck('name', 'id');
        $view->with('categoryOptions', $categoryOptions)
            ->with('storageOptions', $storageOptions);
    }
235046
protected function generateView($view, $path)
    {
        $this->call(
            'generate:view',
            array(
                'name'       => $view,
                '--path'     => $path,
                '--template' => $this->getViewTemplatePath($view)
            )
        );
    }
1223175
public function compose(View $view)
    {
        $view->with('categoriesRatios', $this->prepareRatios(
            $this->cachedCategories()->load(['posts'])
        ));
    }
581000
public function registerAssetFiles($view)
    {
        $this->css = [$this->url . $this->version . '/styles/' . $this->style];
        $this->js = [$this->url . $this->version . '/highlight.min.js'];
        
        parent::registerAssetFiles($view);
    }