Skip to main content
Slots · Revision #4

How do I inject into admin slots?

How do I inject into admin slots?

Admin Slots allow you to add content within existing admin pages. The examples below show how to inject a view into the product edit page.

For a simple use case, simply provide a view:

\Aero\Admin\AdminSlot::inject('catalog.product.edit.cards', 'acme::products');

For more advanced use cases, instead of passing a view directly, you can provide a callback function:

\Aero\Admin\AdminSlot::inject('catalog.product.edit.cards', function ($data) {
    // add custom variables to the $data array

    return view('acme::products', $data);
});

These injections should typically sit inside the boot method of a Service Provider