小编Meh*_*kri的帖子

基于外表属性的雄辩过滤结果

我在用laravel和雄辩。
实际上,我在基于另一个表的属性条件筛选表结果时遇到问题。
我有3张桌子:

  • 会场

  • 这里是关系:
    a city有很多locations,a location属于a city
    a location属于a venue而a venue具有一个location

city_id在位置表上有一个属性,您可以从关系中找出来。

问题很简单:
如何获得属于特定城市的场地?
我期望的雄辩的查询如下所示:
$venues=Venue::with('location')->where('location.city_id',$city->getKey());

当然这行不通,但似乎这是常见的任务,并且会有雄辩的命令。
谢谢!

foreign-collection laravel eloquent laravel-5

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

Laravel config/app.php没有更新

在laravel 5中,config/app.php我将语言环境设置为'ar',但在尝试通过以下方式获取代码中的语言环境时: config('app.locale');

我仍然得到'en'.似乎config/app.php没有自动加载/更新.

即使config/app.php为空,执行config('app');返回:

array:10 [?
"debug" => true
"url" => "http://localhost"
"timezone" => "UTC"
"locale" => "en"
"fallback_locale" => "en"
"key" => "XXXXXXXXXXXXXXXXXXXXXXX" // changed here
"cipher" => "AES-256-CBC"
"log" => "single"
"providers" => array:31 [?]
"aliases" => array:36 [?]]
Run Code Online (Sandbox Code Playgroud)

一些提示将不胜感激.

configuration-files laravel laravel-5

6
推荐指数
2
解决办法
8939
查看次数

什么是git flow中的support命令

我知道什么是bugfix,修补程序和功能分支.
但是我无法掌握的是支持命令git flow support start <version> <branch>

有人可以用一个简单的场景解释这个命令吗?

git git-flow

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

无法在 Android 谷歌登录中从谷歌获取令牌 id

我已将我的 Android 应用程序签名为 google console 上的 api,并将我的后端服务器签名为 google console 中的 oauth 客户端。
我还更新了我的 gradle 文件,以及获取令牌 Id 所需的一切。
但不知何故,我总是无法从谷歌获得令牌。
我已经从 google 控制台检查了我的包名称和 ssh1 代码,并通过 with 命令将其与我的调试 ssh1 进行了匹配:keytool -list -v -keystore mydebudpath\debug.keystore

我将在这里提交我的 Android 代码:

 @Override
      public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    validateServerClientID();
    // [START configure_signin]
    // Request only the user's ID token, which can be used to identify the
    // user securely to your backend. This will contain the user's basic
    // profile (name, profile picture URL, etc) …
Run Code Online (Sandbox Code Playgroud)

authentication android google-plus google-oauth developer-console

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

如果在私有构造函数中初始化,则从静态方法访问时,保证私有静态字段为非null

我有一个名为UrlControllerThe class的类,如:

public class UrlController {
    private static final String BASE_URL = "http://api.site.mil/";       

    private static Retrofit retrofit;

    private UrlController() {
        retrofit = new Retrofit.Builder()
                .baseUrl(BASE_URL)
                .addConverterFactory(GsonConverterFactory.create())
                .build();
    }

    public static Retrofit getRetrofit() {
        return retrofit;
    }
} 
Run Code Online (Sandbox Code Playgroud)

我应该检查if(retrofit==null)getRetrofit()方法,或者它始终没有空?

java static initialization

2
推荐指数
2
解决办法
161
查看次数

如何在不改变状态的情况下附加数据

我正在创建一个分页系统。
减速器部分如下所示:

(state, payload)=> {
            if (state.venues === null) {
                    state.venues = [];
            }
            state.venues.push.apply(state.venues, payload.data)
            return {
                    ...state,
                    isRequesting: false,
                    hasVenues: true,
                    venues: state.venues,
                    hasMessage: false
            }
    },
Run Code Online (Sandbox Code Playgroud)

state.venues在组件中迭代。
问题是,对于第一个请求,它state.venues是空的,所以我应该将它转换为空数组以将有效负载附加到它。
但是通过这种方法,我想我改变了 redux 中不允许(推荐)的状态。
那么如何在没有状态突变的情况下实现这一目标呢?

reactjs redux

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

Material ui 中的夹子抽屉

根据docs, material-ui 支持持久抽屉。
但我预期的行为是像照片一样剪下的持久抽屉。

在此处输入图片说明

我的侧边栏组件:

import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { withStyles } from 'material-ui/styles';
import Drawer from 'material-ui/Drawer';
import List, { ListItem, ListItemIcon, ListItemText } from 'material-ui/List';
import Face from 'material-ui-icons/Face';
import Person from 'material-ui-icons/Person';
import Assignment from 'material-ui-icons/Assignment';
import NavLink from 'react-router-dom/NavLink';
import { FormattedMessage } from 'react-intl';
import styles from '../../../../style/components/global/Sidebar.scss';

const cx = require('classnames/bind').bind(styles);

const rootStyles = theme => ({
  list: {
    width: 250,
    flex: 'initial',
  }, …
Run Code Online (Sandbox Code Playgroud)

material-ui

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