Bagisto Forum

    Bagisto

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    More about Flash messages.

    General Discussion
    3
    5
    738
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K
      karkiswapnil last edited by

      Can you tell me how to use them properly? How they are invoked?
      And mostly how to invoke them after an Ajax request because currently i find that messages work only when pages are reloaded.
      Thank you.

      1 Reply Last reply Reply Quote 0
      • R
        rahul last edited by rahul

        Hi @karkiswapnil

        We have created a method called 'addFlashMessages' in our js file, using which you can invoke them during time of ajax request.

        window.flashMessages = [{
             'type': 'alert-success',
              'message': response.data.message
        }
        
         this_this.$root.addFlashMessages();
        

        Note -
        'type' => 'alert-success', 'alert-warning, 'alert-error' & 'alert-info'.
        'message' => response message returning from controller.

        Thanks

        1 Reply Last reply Reply Quote 0
        • K
          karkiswapnil last edited by

          can you explain a bit more with some examples. Thank you

          1 Reply Last reply Reply Quote 0
          • R
            rahul last edited by

            Hi @karkiswapnil

            A flash message is used to communicate back to the user of the website or application that an event has taken place.This may be something the user intended to do, or it might be something that is just informational. The key to remember about flash messages is that they are not persistent.They can be success message, error message, info message, warning message etc.

            Just think that we have completed an action & did not show any information about that to user then what a user will think.Whether its done or not. He will not clear with action.
            So, after every event we show flash message to user accordingly -

            Success - 
            session()->flash('success', trans('admin::app.response.update-success', ['name' => 'Attribute']));
            
            Error - 
            session()->flash('error', trans('admin::app.response.delete-failed', ['name' => 'Attribute']));
            
            Warning - 
             session()->flash('warning', trans('admin::app.response.customer-associate', ['name' => 'Customer Group']));
            
            Info - 
             session()->flash('info', trans('admin::app.datagrid.mass-ops.partial-action', ['resource' => 'attributes']));
            

            Thanks

            1 Reply Last reply Reply Quote 0
            • elliottkennedyy
              elliottkennedyy last edited by

              Interesting

              1 Reply Last reply Reply Quote 0
              • First post
                Last post