Service Providers

Introduction

Streams provides a stream-lined service provider for integrating easily with Laravel and Streams.

Getting Started

Extend the Streams\Core\Support\Provider to get started defining your own service provider.

namespace App\Providers;

use Streams\Core\Support\Provider;

class YourProvider extends Provider
{
    // This is your stuff.
}

Integration

@todo Important to note: Uses Integrator.

Basic Usage

Assets

The assets property specifies named assets to register.

public $assets = [
    'theme.js' => 'resources/js/theme.js',
];

Routes

The routes property specifies routes to register. Routes are specified by middleware group.

public $routes = [
    'web' => [
        '/' => 'App\Http\[email protected]',
    ],
];

You can also specify routes as an array of route options

public $routes = [
    'web' => [
        '/' => [
            'stream' => 'pages',
            'entry' => 'home',
            'view' => 'welcome',
        ],
    ],
];

Policies

The policies property specifies policies to register.

public $policies = [
    // ...
];

Streams

The streams property specifies streams to register.

public $streams = [
        'contacts' => [
            'name' => 'Contacts',
        'source' => [
            'type' => 'filebase',
            'filename' => 'streams/data/contacts',
            'format' => 'json'
        ],
        'config' => [
            'prototype' => 'Streams\Core\Entry\Entry',
            'collection' => 'Illuminate\Support\Collection'
        ],
        'fields' => [
            'name' => 'string',
            'email' => 'email',
            'company' => [
                'type' => 'relationship',
                'config' => [
                    'related' => 'companies'
                ]
            ]
        ],
    ]
];

Listeners

The listeners property specifies event listeners to register.

public $listeners = [
    'example.event' => [
        'App\Event\Listener\ExampleListener',
    ],
];

Providers

The providers property specifies service providers to register.

public $providers = [
    'App\Providers\CustomProvider',
];

Middleware

The middleware property specifies grouped middleware to register.

public $middleware = [
    'web' => [
        'App\Http\Middleware\ExampleMiddleware',
    ],
];

Commands

The commands property specifies Artisan commands to register.

public $commands = [
    'App\Console\ExampleCommand',
];

Schedules

The schedules property specifies scheduled commands to register.

public $schedules = [
    '* * * * *' => [
        'App\Console\ExampleCommand',
    ],
];