Activating a Plugin

Vanguard - Advanced PHP Login and User Management Vanguard - Advanced PHP Login and User Management / Plugins Last updated on Updated  Sep 13, 2019

Every Vanguard plugins need to be activated after the installation. All you need to do in order to enable the plugin is to reference it's service provider class inside the array that is being returned from the plugins() method in app/Providers/VanguardServiceProvider.php.

In our case, it will look something like following (pay attention to the use line at the top of the file):

use Vanguard\Foo\Foo;

//...

protected function plugins()
{
    return [
        Dashboard::class,
        Users::class,
        UserActivity::class,
        RolesAndPermissions::class,
        Settings::class,
        Foo::class, // or you can add it as a string, like '\Vanguard\Foo\Foo'
    ];
}

As soon as the plugin is activated it will automatically register a new route for you, which you can use to test if the plugin is installed properly. In our example from above, you should be able to navigate to "/foo" page and it will show something like the following:

7gg28OnTw4OqzsK2QgdWn9ZwCqe1vDhz03RIBR0b.png