How do I inject into a slot in the account area?

You can inject into account area slots using the Aero\AccountArea\AccountAreaSlot::inject method. This method accepts two parameters, the key of the slot you want to inject into and then the view or a closure that defines the view to be injected. When passing a closure it enables you to add additional view data to use inside of your injected view.


namespace Acme\MyModule;

use Aero\AccountArea\AccountAreaSlot;
use Aero\Common\Providers\ModuleServiceProvider;

class ServiceProvider extends ModuleServiceProvider
   public function setup()
       $this->loadViewsFrom(__DIR__.'/../resources/views', 'my-module');

       AccountAreaSlot::inject('orders.order.card.header', 'my-module::account-area-slot');

       AccountAreaSlot::inject('orders.order.card.header', function ($data) {
           $data['custom_data'] = 'custom value';

           return view('my-module::account-area-slot', $data);

Articles in this section

Was this article helpful?
0 out of 0 found this helpful