| Package Data | |
|---|---|
| Maintainer Username: | marcoboom |
| Package Create Date: | 2017-02-09 |
| Package Last Update: | 2017-02-09 |
| Language: | PHP |
| License: | MIT |
| Last Refreshed: | 2025-11-06 15:06:49 |
| Package Statistics | |
|---|---|
| Total Downloads: | 64 |
| Monthly Downloads: | 0 |
| Daily Downloads: | 0 |
| Total Stars: | 1 |
| Total Watchers: | 4 |
| Total Forks: | 0 |
| Total Open Issues: | 0 |
This package creates a singleton into the Service container. In this site container you can put from your whole application items.
At the end the container will be added as a shared view variable.
Install it with composer
composer require laravel-admin/site
Add the Service Provider to your config/app.php
LaravelAdmin\Site\SiteServiceProvider::class,
The package has a config, with a basic structure. Publish this config to define your defaults.
artisan vendor:publish --tag="site"
The container is available in the whole application with:
app('site')
app('site')->set('title', 'My website title');
The container is compatible with the dotted array notation, like config
app('site')->set('seo.title', 'This is my SEO improved title');
app('site')->get('title');
app('site')->get('seo.title');
Imagine you have a model with some default content attributes, like title, description and content. With one command you can fill all items in the container.
app('site')->model($post);
The container will be available in all your views as the $site variable. Use it as follow:
{{ $site->get('title') }}