oburatongoi / productivity
生产力 - Artisan Pixelworks 的生产力 API
Requires
- algolia/algoliasearch-client-php: ^1.15
- chocoholics/exceptional: ^0.0.4
- doctrine/dbal: ^2.5
- genealabs/laravel-caffeine: ^0.4.2
- illuminate/support: ~5
- kalnoy/nestedset: ^4.2
- laracasts/utilities: ~2.0
- laravel/scout: ^3.0
- propaganistas/laravel-fakeid: ^2.0
- silber/bouncer: v1.0.0-beta.4
- dev-master
- 0.4.45
- 0.4.44
- 0.4.43
- 0.4.42
- 0.4.41
- 0.4.40
- 0.4.39
- 0.4.38
- 0.4.37
- 0.4.36
- 0.4.35
- 0.4.34
- 0.4.33
- 0.4.32
- 0.4.31
- 0.4.30
- 0.4.29
- 0.4.28
- 0.4.27
- 0.4.26
- 0.4.25
- 0.4.24
- 0.4.23
- 0.4.22
- 0.4.21
- 0.4.20
- 0.4.19
- 0.4.18
- 0.4.17
- 0.4.16
- 0.4.15
- 0.4.14
- 0.4.13
- 0.4.12
- 0.4.11
- 0.4.10
- 0.4.9
- 0.4.8
- 0.4.7
- 0.4.6
- 0.4.5
- 0.4.4
- 0.4.3
- 0.4.2
- 0.4.1
- 0.4.0
- 0.3.40
- 0.3.39
- 0.3.38
- 0.3.37
- 0.3.36
- 0.3.35
- 0.3.34
- 0.3.33
- 0.3.32
- 0.3.31
- 0.3.30
- 0.3.29
- 0.3.28
- 0.3.27
- 0.3.26
- 0.3.25
- 0.3.24
- 0.3.23
- 0.3.22
- 0.3.21
- 0.3.20
- 0.3.19
- 0.3.18
- 0.3.17
- 0.3.16
- 0.3.15
- 0.3.14
- 0.3.13
- 0.3.12
- 0.3.11
- 0.3.10
- 0.3.9
- 0.3.8
- 0.3.7
- 0.3.6
- 0.3.5
- 0.3.4
- 0.3.3
- 0.3.2
- 0.3.1
- 0.3.0
- 0.2.9
- 0.2.8
- 0.2.7
- 0.2.6
- 0.2.5
- 0.2.4
- 0.2.3
- 0.2.2
- 0.2.1
- 0.2.0
- 0.1.36
- 0.1.35
- 0.1.34
- 0.1.33
- 0.1.32
- 0.1.31
- 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
- 0.0.13
- 0.0.12
- 0.0.11
- 0.0.10
- 0.0.9
- 0.0.8
- 0.0.7
- 0.0.6
- 0.0.5
- 0.0.4
- 0.0.3
- 0.0.2
- 0.0.1
This package is auto-updated.
Last update: 2024-09-05 18:49:06 UTC
README
安装
兼容 Laravel 5。安装时运行
$ composer install oburatongoi/productivity
.
接下来,将服务提供者添加到 app/config.app
文件中的提供者数组中
Oburatongoi\Productivity\Providers\ProductivityServiceProvider::class,
在你的 .env 文件中,添加以下变量
SESSION_DOMAIN=.your-domain.com
注意域名名前的 '.'
PRODUCTIVITY_LOGO=logo-text
默认为 'Productivity'
PRODUCTIVITY_DOMAIN=your-domain.com
PRODUCTIVITY_SUBDOMAIN=productivity
如果使用 Scout 与 Algolia,设置以下环境变量
FOLDER_INDEX_NAME=the-name-of-your-folder-index
默认为 prod_FOLDERS
CHECKLIST_INDEX_NAME=the-name-of-your-folder-index
默认为 prod_CHECKLISTS
确保更新你的 DNS 'A' 或 'CNAME' 设置以包括新名称,如果你没有通配符子域名加密,请为所需的子域名添加 SSL 加密。
接下来,发布包的视图、迁移和路由
$ php artisan vendor:publish
你需要强制发布生产力配置。请注意,这将添加或覆盖配置文件夹中的以下文件:productivity.php、fakeid.php 和 javascript.php
php artisan vendor:publish --tag=productivity --force
接下来,将 Productive 特性添加到你的应用程序的用户模型中
use Oburatongoi\Productivity\Traits\Productive; class User extends Authenticatable { use Notifiable, Productive; // ... User class methods }
为了正确处理某些异常,将以下内容添加到你的 app\Exceptions\Handler.php
文件中
use Illuminate\Session\TokenMismatchException as TokenMismatchException; use AlgoliaSearch\AlgoliaException as AlgoliaException; use Bugsnag; class Handler extends ExceptionHandler { /** * A list of the exception types that should not be reported. * * @var array */ protected $dontReport = [ \Illuminate\Session\TokenMismatchException::class, \AlgoliaSearch\AlgoliaException::class, ]; /** * Report or log an exception. * * This is a great spot to send exceptions to Sentry, Bugsnag, etc. * * @param \Exception $exception * @return void */ public function report(Exception $exception) { Bugsnag::notifyException($exception); parent::report($exception); } /** * Render an exception into an HTTP response. * * @param \Illuminate\Http\Request $request * @param \Exception $exception * @return \Illuminate\Http\Response */ public function render($request, Exception $exception) { if ($exception instanceof TokenMismatchException) { Bugsnag::notifyException($exception); if ($request->expectsJson()) return response()->json([ 'tokenMismatch' => true, 'input' => $request->except(['password']), 'url' => $request->fullUrl(), 'method' => $request->method(), 'token' => csrf_token() ]); } if ($exception instanceof AlgoliaException) { Bugsnag::notifyException($exception); if ($request->expectsJson()) return response()->json([ 'algoliaException' => true, 'input' => $request->except(['password']) ]); } return parent::render($request, $exception); }
最后,运行迁移以将生产力文件夹添加到数据库中。请注意,生产力的所有表都有 productivity_ 前缀,所以请确保你的数据库中没有命名冲突
$ php artisan migrate
入门指南
当将生产力添加到新的 Laravel 安装中时,请考虑以下操作
- 更改 config/app 中的应用程序名称
- 安装 Bugsnag
- 安装和配置 Algolia
- 安装和配置 Redis
- 安装和配置 JosephSilber/bouncer 包