Forum

Ask, reply and learn. Join the community of Akaunting.

New Discussion

Overriding Components with custom module

Ibrahim Saleh   ( User )

Commented 1 year ago

I am trying to overriding a component with a custom module but not working as expected, here is my code any guidance is appreciated:

I used artisan to generate the module, then I edited the Main.php provider to include my override per the following documentation https://developer.akaunting.com/documentation/overriding-output/

I only added this to the boot function:
View::composer(
['email.body'],
'Modules\MyModule\View\Components\Email'
);

Here is my Email Class:

Ibrahim Saleh   ( User )

Commented 1 year ago

Here is the rest of the post:

use Illuminate\View\View;

class Email
{
/**
* Bind data to the view.
*
* @param View $view
* @return mixed
*/
public function compose(View $view)
{
// Override the whole file
$view->setPath(view('my-module::email.body')->getPath());
}
}

And here is where I placed my blade file:
modules/MyModule/Resources/views/components/email/body.blade.php

Any help is appreciated

Please login or register to leave a response.

Showing 1 to 2 of 2 discussions