View Render Event Bagisto

Render Template Using view_render_event()

With the help of the view_render_event()  you can inject anything before or after the content of a template.This is very help full to add any content before or after the content in your template in Bagisto.

You can define any event (view_render_event()) in template by following steps:

Steps:

1- Create an event in the blade file in which you want to render any content before or after any content of that template:

As you can see, bagisto.shop.test is event name here that is define in a random blade file of the project.

2- Now you have to listen the event at EventServiceProvider file and in the boot method like:

As you can see, you have to add path of template here that you want to render.

After that this will automatically fire and the your template will be inject before the content.

Make sure that you have registered EventServiceProvider in your ServiceProvider’s.

 

Hope it will be helpful for you. If you have any issue feel free to raise a ticket at https://bagisto.uvdesk.com/en/

. . .

Comments (2)

Add Your Comment

  • Eduar
    How can I pass a variable to that view?
    • saurav pathak
      Hello Eduar,

      Greetings!!!

      Please post this query once on our forum so our dev can look into it: https://forums.bagisto.com/

  • Start a Project



      Message Sent!

      If you have more details or questions, you can reply to the received confirmation email.

      Back to Home