2017 © Pedro Peláez
 

laravel-package site

Container for Laravel for collecting data for views

image

laravel-admin/site

Container for Laravel for collecting data for views

  • Thursday, February 9, 2017
  • by marcoboom
  • Repository
  • 4 Watchers
  • 1 Stars
  • 23 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Site container for your Laravel Project

This package creates a singleton into the Service container. In this site container you can put from your whole application items., (*1)

At the end the container will be added as a shared view variable., (*2)

Installation

Install it with composer, (*3)

composer require laravel-admin/site

Add the Service Provider to your config/app.php, (*4)

LaravelAdmin\Site\SiteServiceProvider::class,

The package has a config, with a basic structure. Publish this config to define your defaults., (*5)

artisan vendor:publish --tag="site"

Usage

The container is available in the whole application with:, (*6)

app('site')

Add item to the container

app('site')->set('title', 'My website title');

Add subitem to the container

The container is compatible with the dotted array notation, like config, (*7)

app('site')->set('seo.title', 'This is my SEO improved title');

Get item

app('site')->get('title');

Get sub item

app('site')->get('seo.title');

Add your model

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., (*8)

app('site')->model($post);

Views

The container will be available in all your views as the $site variable. Use it as follow:, (*9)

{{ $site->get('title') }}

The Versions

09/02 2017

dev-master

9999999-dev

Container for Laravel for collecting data for views

  Sources   Download

MIT

09/02 2017

0.1.1

0.1.1.0

Container for Laravel for collecting data for views

  Sources   Download

MIT

09/02 2017

0.1.0

0.1.0.0

Container for Laravel for collecting data for views

  Sources   Download

MIT