Any view you wish to inject into a slot should be defined in a Service Provider.
If the code is unique to a particular store it could be placed in the boot method of the AppServiceProvider. If it is to be included as part of a module, then it can be added in the setup method of the module's ServiceProvider.
When registering the view to be injected into the slot, you must provide the slot name along with the view, for example:
<?php
namespace Acme\MyModule;
use Aero\Admin\AdminSlot;
use Aero\Common\Providers\ModuleServiceProvider;
class ServiceProvider extends ModuleServiceProvider
{
public function setup(): void
{
AdminSlot::inject('catalog.product.edit.cards', 'my-module::admin-slot');
}
}
For advanced cases where additional data needs to be passed into your view, a closure can be used. The closure receives a $data parameter that contains the current variables on the page.
AdminSlot::inject('catalog.product.edit.cards', function ($data) {
// add custom variables to the $data array
return view('my-module::admin-slot', $data);
});