Created
April 7, 2020 00:00
-
-
Save shameemreza/359c3670cd3c2ceab16011386563b073 to your computer and use it in GitHub Desktop.
Arr::has()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// We import the support for this Helper | |
use Illuminate\Support\Arr; | |
$products = ['drinks' => ['Name' => 'Strawberry Juice', 'price' => '3.60']]; | |
$check = Arr::has($products, 'drinks.name'); | |
// We get true | |
$check = Arr::has($products, ['drinks.name', 'drinks.price']); | |
// We get true | |
$check = Arr::has($products, ['drinks.name', 'drinks.stock']); | |
// We get false, because the 'stock' field does not exist in the variable $products |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment