小编kam*_*bar的帖子

如何在运行时绑定配置值 Laravel 服务提供者?

我创建了扩展 XeroServiceProvide 的自定义服务提供者,基本上,我有多个 Xero 帐户,我想更改两个配置参数值 runtime consumer_keyconsumer_secret。有没有快捷的方法。我检查了服务容器上下文绑定,但不知道如何使用。

<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use DrawMyAttention\XeroLaravel\Providers\XeroServiceProvider;

class CustomXeroServiceProvider extends XeroServiceProvider
{
    private $config = 'xero/config.php';

    /**
     * Bootstrap the application services.
     *
     * @return void
     */
    public function boot()
    {
        //
        parent::boot();
    }

    /**
     * Register the application services.
     *
     * @return void
     */
    public function register($configParams = [])
    {
        parent::register();

        if(file_exists(config_path($this->config))) {
            $configPath = config_path($this->config);
            $config = include $configPath;
        }

        $this->app->bind('XeroPrivate', function () use ($config,$configParams) { …
Run Code Online (Sandbox Code Playgroud)

php symfony laravel-5 xero-api laravel-5.4

6
推荐指数
1
解决办法
1009
查看次数

如何用玩笑模拟 dynamoDB 调用?

我有一个简单的处理程序,调用 getData 在单独的文件中定义

export const handler = async (event: APIGatewayProxyEvent): Promise<APIGatewayProxyResult> => {
  let respData = await new DynamoDBClient().getData(123);
  return {
    statusCode: 200,
    body: JSON.stringify(respData),
  };
};
Run Code Online (Sandbox Code Playgroud)

在我的 DynamoDB 课程中,我有以下内容。

import { DynamoDB } from 'aws-sdk';
export default class DynamoDBClient {
private config: Config;
private client: DynamoDB.DocumentClient;

constructor() {
  this.config = getConfig();

  const dynamoDBClientConfig = this.config.mockDynamoDBEndpoint
  ? {
      endpoint: this.config.mockDynamoDBEndpoint,
      sslEnabled: false,
      region: 'local'
    }
  : undefined;

 this.client = new DynamoDB.DocumentClient(dynamoDBClientConfig);
}
// function
getData= async (id: string): Promise<any> => …
Run Code Online (Sandbox Code Playgroud)

testing unit-testing amazon-dynamodb typescript jestjs

5
推荐指数
1
解决办法
4778
查看次数

各个元素的引用行为是否与数组容器的引用状态分离?

这是什么意思"换句话说,数组的引用行为是在逐个元素的基础上定义的;各个元素的引用行为与数组容器的引用状态分离."

单个元素如何与数组容器的引用状态分离?我是彻底的医生,我很困惑这意味着什么?

<?php
/* Assignment of scalar variables */
$a = 1;
$b =& $a;
$c = $b;
$c = 7; //$c is not a reference; no change to $a or $b

/* Assignment of array variables */
$arr = array(1);
$a =& $arr[0]; //$a and $arr[0] are in the same reference set
$arr2 = $arr; //not an assignment-by-reference!
$arr2[0]++;
/* $a == 2, $arr == array(2) */
/* The contents of $arr are changed even though it's …
Run Code Online (Sandbox Code Playgroud)

php reference pass-by-reference

3
推荐指数
1
解决办法
59
查看次数

如果应用程序崩溃,如何重置默认亮度?

在我的应用程序中,我试图将全亮度应用到我的视图中,并将当前亮度存储在一个变量中,因此一旦我的应用程序状态变为后台/ resign-activity,我就会重置默认亮度,现在我的问题是,如果是我的应用程序崩溃我重置默认亮度的事件是什么,有任何方法在应用程序崩溃时调用?

提前致谢.

iphone objective-c ios

1
推荐指数
1
解决办法
683
查看次数

参数不起作用的laravel路线

路由参数不起作用,它是抛出和错误

throw new NotFoundHttpException;
Run Code Online (Sandbox Code Playgroud)

routes.php文件

Route::any('/share-to-group/(:any)/(:any)',array('as' => 'share-to-group',  
                                 'uses' => 'HomeController@shareToGroup'));
Run Code Online (Sandbox Code Playgroud)

视野内

<a href="{{ URL::to('share-to-group',[ $group['group_id'], $UnixDateTime ]) }}">Something</a>
Run Code Online (Sandbox Code Playgroud)

和控制器

function shareToGroup($group_id,$unixtime){
        echo $group_id.$unixtime;exit;
}
Run Code Online (Sandbox Code Playgroud)

我在做什么?

我已经审查了以下链接,但这是完全不同的,这之间没有任何独特之处,我认为这不重复. 如何将查询字符串参数传递给Laravel4中的路由

php routes laravel laravel-4

0
推荐指数
1
解决办法
3290
查看次数