nodes / backend
此软件包已被放弃,不再维护。未建议替代软件包。
Nodes后端软件包
3.2.7
2020-04-08 14:38 UTC
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
一个简单、干净的后端,适用于Laravel。
📝 简介
我们团队在Laravel中缺少一个快速实现且易于构建的后端。
📦 安装
安装此软件包需要
- Laravel 5.1+
- PHP 5.5.9+
然后您必须修改您的 composer.json
文件并运行 composer update
以将软件包的最新版本包含到您的项目中。
"require": {
"nodes/backend": "3.1.*",
}
或者您可以从终端运行 composer require 命令。
composer require nodes/backend
🔧 配置
在 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,
在 config/app.php 中配置别名
'Backend' => Nodes\Backend\Support\Facades\Backend::class,
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
一次性发布所有配置文件,由于我们覆盖了gulp,我们需要在backend上使用强制,常规的 vendor:publish 仅适用于其他3个软件包
php artisan vendor:publish && php artisan vendor:publish --provider="Nodes\Backend\ServiceProvider" --force
仅发布后端插件配置文件
php artisan vendor:publish --provider="Nodes\Backend\ServiceProvider"
仅覆盖后端插件配置文件
php artisan vendor:publish --provider="Nodes\Backend\ServiceProvider" --force
将以下内容添加到您的 /database/seeds/DatabaseSeeder.php 中
$this->call('NodesBackendSeeder');
转储
composer dump-autoload
现在您可以运行 php artisan migrate --seed,这将添加新的表并初始化角色/用户以开始使用
添加到 config/nodes/autoload.php
'project/Routes/Backend/',
运行 bower,npm & gulp 以构建 css & js
bower install && npm install && gulp build
通过在 App\Http\Middleware\VerifyCsrfToken.php 中传递来设置 CSRF
protected $except = [
'admin/manager_auth',
];
使 TokenMismatch 异常更友好,将以下内容添加到 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) {}
}
....
}
⚙ 使用
全局函数
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()->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')
🏆 致谢
此软件包由Nodes的PHP团队开发和维护
📄 许可证
此软件包是开源软件,根据MIT许可证许可