Php 使用'=';在';加入';或';其中';在拉威尔?

Php 使用'=';在';加入';或';其中';在拉威尔?,php,laravel,join,laravel-5,where,Php,Laravel,Join,Laravel 5,Where,我用了两种方法: $this->data = DB::table('projects') ->select('companies_info.*', 'project_roles_types.name AS project_role_name') ->join('project_companies_members', 'project_companies_members.project_id', 'projects.project_id') ->

我用了两种方法:

$this->data = DB::table('projects')
     ->select('companies_info.*', 'project_roles_types.name AS project_role_name')
     ->join('project_companies_members', 'project_companies_members.project_id', 'projects.project_id')
     ->where($some_variable, $project_id)
     ->get();
以及:

对我来说,无论是添加还是删除
=
符号,效果都是一样的。 有人知道这是允许的吗?如果是,最好的方法是什么?
谢谢。

这很好,“=”是查询生成器中的默认运算符


有关“where”代码的源代码,请参阅。它假设如果存在两个参数,则它是equals运算符。

这很好,“=”是查询生成器中的默认运算符


有关“where”代码的源代码,请参阅。它假设如果存在两个参数,则它是equals运算符。

根据源中的函数定义:

// Here we will make some assumptions about the operator. If only 2 values are
// passed to the method, we will assume that the operator is an equals sign
// and keep going. Otherwise, we'll require the operator to be passed in.
因此,您可以看到,如果省略
=
作为第二个参数,查询生成器将默认将其放置在那里,这与您描述的行为一致


根据源代码中的函数定义:

// Here we will make some assumptions about the operator. If only 2 values are
// passed to the method, we will assume that the operator is an equals sign
// and keep going. Otherwise, we'll require the operator to be passed in.
因此,您可以看到,如果省略
=
作为第二个参数,查询生成器将默认将其放置在那里,这与您描述的行为一致