array_intersect_key
laravel/framework
Supported Versions: PHP 5 >= 5.1.0, PHP 7, PHP 8
Computes the intersection of arrays using keys for comparison
array_intersect_key
(array
$array
, array ...
$arrays
): array
public static function
only
(
$array
,
$keys
)
{
return
array_intersect_key
(
$array
,
array_flip
((array)
$keys
));
}
src/Illuminate/Collections/Arr.php
public function
intersectByKeys
(
$items
)
{
return new static(
array_intersect_key
(
$this
->
items
,
$this
->
getArrayableItems
(
$items
)
));
}
src/Illuminate/Collections/Collection.php
protected function
fillableFromArray
(array
$attributes
)
{
if (
count
(
$this
->
getFillable
()) >
0
&& ! static::
$unguarded
) {
return
array_intersect_key
(
$attributes
,
array_flip
(
$this
->
getFillable
()));
}
return
$attributes
;
src/Illuminate/Database/Eloquent/Concerns/GuardsAttributes.php
protected function
getArrayableItems
(array
$values
)
{
if (
count
(
$this
->
getVisible
()) >
0
) {
$values
=
array_intersect_key
(
$values
,
array_flip
(
$this
->
getVisible
()));
}
if (
count
(
$this
->
getHidden
()) >
0
) {
src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php
$fields
=
array_fill_keys
(
$matches
[
0
],
null
);
$route
->
setBindingFields
(
array_replace
(
$fields
,
array_intersect_key
(
$bindingFields
,
$fields
)
));
}
src/Illuminate/Routing/ResourceRegistrar.php
return [];
}
$parameters
=
array_intersect_key
(
$matches
,
array_flip
(
$parameterNames
));
return
array_filter
(
$parameters
, function (
$value
) {
return
is_string
(
$value
) &&
strlen
(
$value
) >
0
;
src/Illuminate/Routing/RouteParameterBinder.php
protected static function
pathsForProviderAndGroup
(
$provider
,
$group
)
{
if (! empty(static::
$publishes
[
$provider
]) && ! empty(static::
$publishGroups
[
$group
])) {
return
array_intersect_key
(static::
$publishes
[
$provider
], static::
$publishGroups
[
$group
]);
}
return [];
src/Illuminate/Support/ServiceProvider.php
$this
->
passes
();
}
$invalid
=
array_intersect_key
(
$this
->
data
,
$this
->
attributesThatHaveMessages
()
);
$result
= [];
src/Illuminate/Validation/Validator.php