• 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

Laravel Livewire: jQuery not working in child component loaded via @if statement

Laravel relationship belongsToMany with composite primary keys

How to properly start Laravel 8 with Bootstrap & authentication

GuzzleHttp Hangs When Using Localhost

How to add class name to an existing tag in php

Laravel passport auth token not working after moving to different server

SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect integer value: 'column_name' in Laravel

Normalize DateInterval in PHP

Generate random username based on full name php

WAMP/Wordpress - cURL error 28: Operation timed out after 10001 milliseconds with 0 bytes received

PHP DOTENV unable to load env vars

Not able to access model in the controller mautic

Assign output of PHP function to a variable

Show Custom Data in Woocommerce Order Details Admin Area

Limit WooCommerce products in cart only from one custom taxonomy

About Contact Privacy policy Terms and conditions