Dialogs

This example illustrates dynamic opening of a dialog but also working with multiple dialogs at once.
  • setController

    Sets the JavaScript class controller - if you need to register an extra event listeners (show, shown, hide, hidden) or logic.

  • setTitle

    Sets the title of a dialog.

  • setBody

    Sets the body of a dialog.

  • setFooter

    Sets the footer of a dialog.

  • setDialog

    Sets the whole content of a dialog.

  • closeDialogs

    Close all opened dialogs.

  • closeDialog

    Close only current dialog.

  • dialog

    Render defined dialog.

namespace App\Http\Controllers;

class DialogController extends Controller
{
    public function __construct(DialogResponse $response)
    {
        $this->response = $response;
    }

    public function showModal()
    {
        $this->response
            ->setTitle('Dialog title')
            ->setBody('HTML body')
            ->setFooter('HTML footer')
            ->dialog();

        // or

        $this->response
            ->setDialog('HTML content')
            ->dialog([
                'backdrop' => 'static',
            ]);

        return $this->response->send();
    }
}

Example

Github