• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

how to get value from array in laravel

phplaravel-4


PHP Snippet 1:

echo $memus[0]['name'];

PHP Snippet 2:

foreach ($memus as $memu) {
       echo $memu['name'];
}

PHP Snippet 3:

collect($arrayName);

$filtered = $arrayName->where('parent', 0);

$filtered->all();

PHP Snippet 4:

{{memus[0]->id}}

PHP Snippet 5:

echo ($menus[0]['parent'] == 0) ? $menus[0]['name'] : '';

PHP Snippet 6:

 foreach ($menus as $menu) {
        if($menu['parent'] == 0){
            echo $menu['name'];
        }
    }

PHP Snippet 7:

  $memus  = Menu::where('parent', 0)->get()->toArray();
    $arr = array();
    foreach ($memus as $s) {
        array_push($arr,$s->buy_product_id)
    }

Related Snippets

How do I enable error reporting in Laravel?

Is there a way to use Foundry Model for Authentification inside Functional Tests?

Laravel MSSQL Server Connection not working

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource [duplicate]

How can I make Laravel return a custom error for a JSON REST API

Spam Filter in Contact Form

How can I stop a symfony process which is listening on http://127.0.0.1:8000

Symfony 4: "Autowire: you should configure its value explicitly."

Composer Warning: openssl extension is missing. How to enable in WAMP

IlluminateDatabaseQueryException could not find driver [duplicate]

How to convert the int value to inch in PHP [closed]

Cannot connect to own websocket server when on secured domain

Install mysql client in docker image

How to get company posts from LinkedIn via API?

Display the WooCommerce product price inside a custom function

About Contact Privacy policy Terms and conditions