Package Data | |
---|---|
Maintainer Username: | skydiver |
Maintainer Contact: | mirosvitok@gmail.com (Miroslav Svitok) |
Package Create Date: | 2015-12-30 |
Package Last Update: | 2016-09-01 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-10-27 15:11:15 |
Package Statistics | |
---|---|
Total Downloads: | 55 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 3 |
Total Forks: | 0 |
Total Open Issues: | 0 |
Laravel 5 wrapper for Adminer. Adminer is an excellent database management tool in a single PHP file written by Jakub Vrana. It's a great replacement for PhpMyAdmin (also supports PostgreSQL, SQLite, MS SQL, Oracle, Firebird, SimpleDB, Elasticsearch and MongoDB).
To include the library, update composer.json
file require
section, with:
"miroc/laravel-adminer": "dev-master"
and run composer update
.
To add adminer to Laravel routes (e.g. /adminer), update routes.php
file with:
Route::any('adminer', '\Miroc\LaravelAdminer\AdminerController@index');
Adminer doesn't work with VerifyCsrfToken middleware, so it has to be disabled on its route.
In VerifyCsrfToken.php
disable CSRF on adminer route by adding it to $except
array:
protected $except = [
'adminer'
];
The easiest way is to create a custom VerifyCsrfToken middleware that excludes selected routes:
use Closure;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken;
class CustomVerifyCsrfToken extends VerifyCsrfToken {
protected $excludedRoutes = ['adminer'];
public function handle($request, Closure $next)
{
if ($this->isExcludedRoute($request)){
return $next($request);
} else {
return parent::handle($request, $next);
}
}
private function isExcludedRoute($request)
{
if (count($request->segments()) > 0
&& in_array($request->segment(1), $this->excludedRoutes)){
return true;
} else {
return false;
}
}
}
And then use that instead of VerifyCsrfToken
in Kernel.php
protected $middleware = [
'Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode',
'Illuminate\Cookie\Middleware\EncryptCookies',
'Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse',
'Illuminate\Session\Middleware\StartSession',
'Illuminate\View\Middleware\ShareErrorsFromSession',
'Path\To\CustomVerifyCsrfToken',
];
Due to function name conflicts of Laravel5 and Adminer, adminer.php file functions 'cookie()', 'redirect()' and 'view()' are prefixed with 'adm_' prefix.
If you find any problem, please let me know.