nodes / backend
Nodes backend package
Requires
- composer-plugin-api: ^1.0
- laravel/framework: >=5.4.0 <6.15.0
- laravelcollective/html: 5.5.*||5.6.*||5.7.*||5.8.*||6.0.*
- nodes/assets: ^1.0
- nodes/bugsnag: ^1.0||^2.0
- nodes/cache: ^1.0
- nodes/core: ^1.0
- nodes/counter-cache: ^2.0
- nodes/database: ^1.0
- nodes/validation: ^1.0
- dev-master
- 3.2.7
- 3.2.6
- 3.2.5
- 3.2.4
- 3.2.3
- 3.2.2
- 3.2.1
- 3.2.0
- 3.1.7
- 3.1.6
- 3.1.5
- 3.1.4
- 3.1.3
- 3.1.2
- 3.1.1
- 3.1.0
- 3.0.11
- 3.0.10
- 3.0.9
- 3.0.8
- 3.0.7
- 3.0.6
- 3.0.5
- 3.0.4
- 3.0.3
- 3.0.2
- 3.0.1
- 3.0.0
- 2.1.10
- 2.1.9
- 2.1.8
- 2.1.7
- 2.1.6
- 2.1.5
- 1.2.5
- 1.2.4
- 1.2.3
- 1.2.2
- 1.2.1
- 1.2.0
- 1.1.21
- 1.1.20
- 1.1.19
- 1.1.18
- 1.1.17
- 1.1.16
- 1.1.15
- 1.1.14
- 1.1.13
- 1.1.12
- 1.1.11
- 1.1.10
- 1.1.9
- 1.1.8
- 1.1.7
- 1.1.6
- 1.1.5
- 1.1.4
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.8
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- 0.1.30
- 0.1.29
- 0.1.28
- 0.1.27
- 0.1.26
- 0.1.25
- 0.1.24
- 0.1.23
- 0.1.22
- 0.1.21
- 0.1.20
- 0.1.19
- 0.1.18
- 0.1.17
- 0.1.16
- 0.1.15
- 0.1.14
- 0.1.13
- 0.1.12
- 0.1.11
- 0.1.10
- 0.1.9
- 0.1.8
- 0.1.7
- 0.1.6
- 0.1.5
- 0.1.4
- 0.1.3
- 0.1.2
- 0.1.1
- 0.1.0
- dev-feature/do-not-use-random-str-helper
- dev-hotfix/fix_query_unset
- dev-develop
- dev-hotfix/fix_symfony_compatibility
- dev-bugfix/fix_illuminate_compatibility
- dev-analysis-gOK1a4
- dev-feature/laravel6
- dev-analysis-q1BykL
- dev-analysis-8QWPZj
- dev-fix/login-remember-check
- dev-analysis-860gwW
- dev-version1.x
- dev-Casperhr-patch-2
- dev-feature/1489
- dev-update-file-picker
- dev-Casperhr-patch-1
- dev-analysis-zRmQDD
- dev-custom-charts
- dev-feature/disable-password-hash
- dev-feature/validation-error-errors-compat
- dev-reset_password_fix_5.3
- dev-feature/remove-autocomplete-from-sensitive-fields
- dev-feature/secure-password-reset
- dev-feature/password-confirmation-be-user-edit
- dev-feature/revert-alert-fix
- dev-feature/reset-password-validation
- dev-github-issue-58
- dev-feature/php-unit
- dev-feature/file-picker
- dev-feature/backend-theming
This package is auto-updated.
Last update: 2024-05-17 19:26:05 UTC
README
A easy and clean backend to Laravel.
📝 Introduction
One thing we at Nodes have been missing in Laravel is a fast implemented backend which is easy to build on top of
📦 Installation
To install this package you will need:
- Laravel 5.1+
- PHP 5.5.9+
You must then modify your composer.json
file and run composer update
to include the latest version of the package in your project.
"require": {
"nodes/backend": "3.1.*",
}
Or you can run the composer require command from your terminal.
composer require nodes/backend
🔧 Setup
Setup service providers in config/app.php
Nodes\Backend\ServiceProvider::class,
Nodes\Assets\ServiceProvider::class,
Nodes\Validation\ServiceProvider::class,
Nodes\Cache\ServiceProvider::class,
Collective\Html\HtmlServiceProvider::class,
Nodes\ServiceProvider::class,
Setup alias in config/app.php
'Backend' => Nodes\Backend\Support\Facades\Backend::class,
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
Publish config file all config files at once, we need to use force on backend, since we override gulp. The regular vendor:publish is for the 3 other packages
php artisan vendor:publish && php artisan vendor:publish --provider="Nodes\Backend\ServiceProvider" --force
Publish config file for backend plugin only
php artisan vendor:publish --provider="Nodes\Backend\ServiceProvider"
Overwrite config file for backend plugin only
php artisan vendor:publish --provider="Nodes\Backend\ServiceProvider" --force
Add following to your /database/seeds/DatabaseSeeder.php
$this->call('NodesBackendSeeder');
Dump
composer dump-autoload
Now you can call php artisan migrate --seed Which will add the new tables and seed the roles/users to get going
Add to config/nodes/autoload.php
'project/Routes/Backend/',
Run bower, npm & gulp to build css & js
bower install && npm install && gulp build
Set up CSRF by pass in App\Http\Middleware\VerifyCsrfToken.php
protected $except = [
'admin/manager_auth',
];
Make TokenMismatch exceptions more user friendly, add following to App\Exceptions\Handler.php
public function render($request, Exception $e)
{
// Just redirect back to previous route if there is any, else all the way back to dashboard
// Instead of a ugly whoops error!
if ($exception instanceof TokenMismatchException) {
try {
return redirect()->back()->with('error', 'Token mismatch, try again')->send();
} catch (\Throwable $e) {}
}
....
}
⚙ Usage
Global function
backend_auth - Access all other function on mananger
backend_user - Retrieve user object
backend_user_check - Check if there is authed user
backend_user_authenticate - Try to auth with current request, pass [] as providers are registered
backend_user_login - Force login another user
backend_user_logout - Logout user
backend_attempt - Attempt to authenticate a user using the given credentials
query_restorer - Use to restore query params from cookie, handy for routing between views with queries
query_restorer_with_flash - Use to restore query params from cookie, handy for routing between views with queries. Remembers the flash between reloads also
backend_router - Access all other router functions
backend_router_pattern - Used fx for selecting navigation item by path
backend_router_alias - Used fx for selecting navigation item by route
Redirect with flash
redirect()->back()->withInput()->with('error', 'Unknown Error') // Only strings
redirect()->back()->withInput()->with('errors', $myErrorBag)
redirect()->back()->withInput()->with('errors', $myValidator->errorsBag());
redirect()->back()->withInput()->with('success', 'Everything is ok')
redirect()->back()->withInput()->with('info', 'Insert info')
redirect()->back()->withInput()->with('warning', 'Insert warning')
🏆 Credits
This package is developed and maintained by the PHP team at Nodes
📄 License
This package is open-sourced software licensed under the MIT license