config/admin.php
parent
158f3f9b58
commit
bd03c095fc
70
README.md
70
README.md
|
|
@ -100,3 +100,73 @@ protected function renderBack()
|
|||
HTML;
|
||||
}
|
||||
```
|
||||
|
||||
## 配置
|
||||
|
||||
- config/app.php
|
||||
|
||||
```php
|
||||
return [
|
||||
'timezone' => env('TIMEZONE', 'Asia/Chongqing'),
|
||||
'locale' => 'zh_CN',
|
||||
];
|
||||
```
|
||||
|
||||
- config/auth.php
|
||||
|
||||
```php
|
||||
return [
|
||||
'api' => [
|
||||
'driver' => 'sanctum',
|
||||
'provider' => 'users',
|
||||
],
|
||||
'providers' => [
|
||||
'users' => [
|
||||
'driver' => 'eloquent',
|
||||
'model' => Peidikeji\User\Models\User::class,
|
||||
],
|
||||
],
|
||||
];
|
||||
```
|
||||
|
||||
- app\Exceptions\Handler.php
|
||||
|
||||
```php
|
||||
public function register()
|
||||
{
|
||||
$this->renderable(function (\Symfony\Component\HttpKernel\Exception\NotFoundHttpException $e, Request $request) {
|
||||
if ($request->ajax()) {
|
||||
return response()->json(['code' => 404, 'message' => $e->getMessage(), 'data' => null], 200);
|
||||
}
|
||||
});
|
||||
$this->renderable(function (\Illuminate\Validation\ValidationException $e, Request $request) {
|
||||
if ($request->ajax()) {
|
||||
$errors = $e->validator->errors();
|
||||
return response()->json(['code' => 422, 'message' => $errors->first(), 'data' => $errors], 200);
|
||||
}
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
- app\Http\Controllers\Controller.php
|
||||
|
||||
```php
|
||||
use Dcat\Admin\Traits\JsonResponse;
|
||||
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
class Controller extends BaseController
|
||||
{
|
||||
use JsonResponse;
|
||||
}
|
||||
```
|
||||
|
||||
- app\Providers\RouteServiceProvider.php
|
||||
|
||||
```php
|
||||
protected function configureRateLimiting()
|
||||
{
|
||||
RateLimiter::for('sms', function (Request $request) {
|
||||
return Limit::perMinute(1)->by($request->input('phone'));
|
||||
});
|
||||
}
|
||||
```
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ return [
|
|||
| If your page is going to be accessed via https, set it to `true`.
|
||||
|
|
||||
*/
|
||||
'https' => env('ADMIN_HTTPS', false),
|
||||
'https' => \Illuminate\Support\Str::startsWith(env('APP_URL'), 'https://'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Reference in New Issue