PHPackages                             leantony/laravel\_modal - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. leantony/laravel\_modal

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

leantony/laravel\_modal
=======================

Laravel Ajax modal, based on bootstrap

15792[2 issues](https://github.com/leantony/laravel_modal/issues)JavaScript

Since Apr 6Pushed 9y ago2 watchersCompare

[ Source](https://github.com/leantony/laravel_modal)[ Packagist](https://packagist.org/packages/leantony/laravel_modal)[ RSS](/packages/leantony-laravel-modal/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel modal
=============

[](#laravel-modal)

Purpose of this package, is to allow quick and easy creation and triggering of modal forms via ajax.

Installation
------------

[](#installation)

### Requirements

[](#requirements)

- laravel. At least version 5.1+
- composer
- jquery
- Bootstrap3.

Use composer to install the package.

```
composer require leantony/laravel_modal:dev-master
```

Add the service provider, in app.php.

```
Leantony\Modal\ServiceProvider::class
```

Publish the assets

```
# publish the javascript assets
php artisan vendor:publish --tag=public --provider="Leantony\Modal\ServiceProvider" --force
# publish the view
php artisan vendor:publish --provider="Leantony\Modal\ServiceProvider"
```

> The javascript files will be copied into the "public/vendor/leantony/modal" folder

The view will be copied to resources/views/vendor/leantony/modal

You can then reference the assets (bootstrap, jquery) on your page

Usage
=====

[](#usage)

A sample modal form....The bootform package used here, isnt really a necessity, so feel free to change this. Only used it because it allows for quick form markup generation in laravel.

> But be sure to leave the *form id* of *modal\_form* as is, since its referenced in javascript.

```
{!! BootForm::openHorizontal(['sm' => [4, 8], 'lg' => [2, 10]])->action($route)->class('form-horizontal')->id('modal_form')->method(isset($method) ? $method : 'POST') !!}

    &times;
    {{ ucwords($action . ' '. class_basename($model)) }}

    {!! BootForm::text('Title', 'title')->placeholder('Enter a title') !!}
    {!! BootForm::textArea('Content', 'content')->placeholder('Enter some content') !!}

    Close
    Save Changes

{!! BootForm::close() !!}
```

A sample page...

```

        Document

        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ad animi architecto deleniti eius odio odit quas quisquam quod repellendus sapiente. Autem deserunt fugiat ipsum iusto molestias odio provident repudiandae voluptates!

    New post

        leantony.modal({});

    @include('modal::container')

        some text here

```

```
```

You'll need to make a copy of the sample modal form provided, to your views, and edit as necessary. This will obviously be different depending on your needs.

In this case, the modal will be triggered on create action. For this example, It is assumed that named your modal form 'create.blade.php'

```
    /**
     * Display the view to create the resource
     *
     * @return Response
     */
    public function create()
    {
        // use render so that only the html for the view is returned as opposed to the layout within which it is in
        return view('posts.create', [
            'route' => route('posts.store'),
            'model' => Post::class,
            'action' => 'create'
        ])->render();
    }
```

> check the variables in the form sample, to know what else can be passed into the modal view. Fee free to add your own

Add a link to your page, that will trigger the modal. Give the link a class of 'show\_modal\_form'

> The class name is important as it instructs the javascript to send an ajax request to the link's href attribute for a view. Which will then be displayed on the page, as a modal.

When you click on the button, the modal should be displayed.

Your store action should return json. For example;

```
    /**
     * Store a newly created resource in storage.
     *
     * @param Request $request
     * @return Response
     */
    public function store(Request $request)
    {
        // quick validation. You can a form request for this
        $this->validate($request, ['title' => 'required', 'content' => 'required|between:5,1000']);

        // save the data
        $post = Post::create($request->all());

        // return json response. The message is, as it will be used to notify the user of their action
        return new JsonResponse([
            'success' => true,
            'message' => 'record created',
        ], 200);
    }
```

For validation, you can use a form request. Don't worry about the validation errors, as they will be displayed automatically on the modal form.

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/78dd5b6393580ed9a6be5b673dd1c5e2ed09e53b91c77f64fd6c815acd902057?d=identicon)[leantony](/maintainers/leantony)

---

Top Contributors

[![leantony](https://avatars.githubusercontent.com/u/7967272?v=4)](https://github.com/leantony "leantony (17 commits)")

---

Tags

laravel-modalmodal-forms

### Embed Badge

![Health badge](/badges/leantony-laravel-modal/health.svg)

```
[![Health](https://phpackages.com/badges/leantony-laravel-modal/health.svg)](https://phpackages.com/packages/leantony-laravel-modal)
```

###  Alternatives

[dktapps/pmforms

Form API library for PocketMine-MP plugins

532.6k1](/packages/dktapps-pmforms)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
