Skip to content

A small middleware that prevents routes being access unless via AJAX methods.

License

Notifications You must be signed in to change notification settings

penance316/laravel-ajax-only-middleware

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Ajax Only Middleware

Description

A small middleware that prevents routes being access unless via AJAX methods.

Install

composer require "penance316/laravel-ajax-only-middleware"

Register the middleware with you app in app/Http/Kernal.php

  /**
    * The application's route middleware.
    *
    * @var array
    */
    protected $routeMiddleware = [
        //... existing code
        'ajax' => Penance316\Middleware\AjaxOnly::class,
    ];
}

Attach middleware to any routes you want to be accessible only via AJAX requests

// File: routes.php
get('someitem/{id}', ['middleware' => 'ajax', 'uses' => 'SomeController@show']);

About

A small middleware that prevents routes being access unless via AJAX methods.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages