Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Added wherePivot to belongsToMany.
- Loading branch information
|
@@ -73,6 +73,34 @@ public function getResults() |
|
|
return $this->get(); |
|
|
} |
|
|
|
|
|
/** |
|
|
* Set a where clause for a pivot table column. |
|
|
* |
|
|
* @param string $column |
|
|
* @param string $operator |
|
|
* @param mixed $value |
|
|
* @param string $boolean |
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany |
|
|
*/ |
|
|
public function wherePivot($column, $operator = null, $value = null, $boolean = 'and') |
|
|
{ |
|
|
return $this->where($this->table.'.'.$column, $operator, $value, $boolean); |
|
|
} |
|
|
|
|
|
/** |
|
|
* Set an or where clause for a pivot table column. |
|
|
* |
|
|
* @param string $column |
|
|
* @param string $operator |
|
|
* @param mixed $value |
|
|
* @param string $boolean |
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany |
|
|
*/ |
|
|
public function orWherePivot($column, $operator = null, $value = null) |
|
|
{ |
|
|
return $this->wherePivot($column, $operator, $value, 'or'); |
|
|
} |
|
|
|
|
|
/** |
|
|
* Execute the query and get the first result. |
|
|
* |
|
|
|
@@ -57,7 +57,8 @@ |
|
|
{"message": "New 'Password::validator' function that allows custom validation on passwords when resetting.", "backport": null}, |
|
|
{"message": "Added support for checking job attempts to Iron.io queue jobs.", "backport": null}, |
|
|
{"message": "Added support for releasing pushed Iron.io jobs back onto the queue.", "backport": null}, |
|
|
{"message": "Allow strict mode option to be enabled for MySQL connections.", "backport": null} |
|
|
{"message": "Allow strict mode option to be enabled for MySQL connections.", "backport": null}, |
|
|
{"message": "Added 'wherePivot' and 'orWherePivot' methods to BelongsToMany relationship for convenience.", "backport": null} |
|
|
], |
|
|
"4.0.x": [ |
|
|
{"message": "Added implode method to query builder and Collection class.", "backport": null}, |
|
|