npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

laravel-data-method

v1.3.2

Published

Helper for laravel data-method links

Downloads

28

Readme

laravel-data-method

This repo provides helpers for form submission in Laravel like link form submission, disabling submit button on form.

Install

Via npm

$ npm install laravel-data-method --save

Via bower

$ bower install laravel-data-method --save

Usage

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <!-- CSRF Token -->
        <meta name="csrf-token" content="FAKETOKEN">

        <title>Laravel Data Method</title>

        <!-- Styles -->
        <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

        <!-- Scripts -->
        <script type="text/javascript" src="node_modules/jquery/dist/jquery.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
        <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
        <script src="https://cdn.jsdelivr.net/npm/sweetalert2@9"></script>
        <script type="text/javascript" src="./dist/data-method.js"></script>
    </head>
    <body>
        <p>
            <!-- Link form with confirmation and params -->
            <a
                href="/"
                class="btn btn-primary"
                data-method="POST"
                data-params='{"id": 4}'
                data-confirm="Are you sure?">Submit Me</a>

            <!-- Link form with confirmation with bootstrap theme -->
            <a
                href="/"
                class="btn btn-primary"
                data-method="POST"
                data-confirm="Are you sure?"
                data-title="Please confirm this action"
                data-theme="bootstrap">Submit Me with bootstrap theme</a>

            <!-- Link form with confirmation with sweetalert2 theme -->
            <a
                href="/"
                class="btn btn-primary"
                data-method="POST"
                data-confirm="Are you sure?"
                data-title="Please confirm this action"
                data-theme="sweetalert">Submit Me with Sweet Alert theme</a>

            <!-- Link form with confirmation with javascript -->
            <a
                href="javascript:dataMethod('/', {confirm: 'Are you sure?', method: 'POST'})"
                class="btn btn-primary">Submit with javascript</a>

            <!-- Link form with confirmation with javascript -->
            <a
                href="/"
                class="btn btn-primary"
                data-method="POST"
                data-params='{"id": 4}'
                data-ajax="true">Submit with Ajax</a>
        </p>

        <!-- Disable form submit button on submit event -->
        <form action="" method="post">
            <button class="btn btn-success" type="submit" data-disabled-submit>Disable form button</button>
        </form>

        <!-- Disable form submit button on submit event with confirm message -->
        <form action="" method="post" class="mt-3">
            <button class="btn btn-success"
                type="submit" data-disabled-submit
                data-confirm="Are you sure?">Disable form button with confirm</button>
        </form>

        <!-- Disable form submit button on submit event with bootstrap theme -->
        <form action="" method="post" class="mt-3">
            <button class="btn btn-primary"
                type="submit"
                data-disabled-submit
                data-confirm="Are you sure?"
                data-title="Please confirm this action"
                data-theme="bootstrap">Disable form button with confirm Bootstrap</button>
        </form>

        <!-- Disable form submit button on submit event with sweetalert theme -->
        <form action="" method="post" class="mt-3">
            <button class="btn btn-primary"
                type="submit"
                data-disabled-submit
                data-confirm="Are you sure?"
                data-title="Please confirm this action"
                data-theme="sweetalert">Disable form button with confirm Bootstrap</button>
        </form>

        <!-- Submit normal form -->
        <form action="" method="post" class="mt-3">
            <button class="btn btn-primary" type="submit">Submit normal form</button>
        </form>
    </body>
</html>

Development

$ git clone https://github.com/brexis/laravel-data-method.git
$ cd laravel-data-method
$ yarn install --production=false
$ npm run build