Laravel: How do I parse this json data in view blade?

It’s pretty easy. First of all send to the view decoded variable (see Laravel Views): view(‘your-view’)->with(‘leads’, json_decode($leads, true)); Then just use common blade constructions (see Laravel Templating): @foreach($leads[‘member’] as $member) Member ID: {{ $member[‘id’] }} Firstname: {{ $member[‘firstName’] }} Lastname: {{ $member[‘lastName’] }} Phone: {{ $member[‘phoneNumber’] }} Owner ID: {{ $member[‘owner’][‘id’] }} Firstname: {{ $member[‘owner’][‘firstName’] … Read more

How to include a sub-view in Blade templates?

You can use the blade template engine: @include(‘view.name’) ‘view.name’ would live in your main views folder: // for laravel 4.X app/views/view/name.blade.php // for laravel 5.X resources/views/view/name.blade.php Another example @include(‘hello.world’); would display the following view // for laravel 4.X app/views/hello/world.blade.php // for laravel 5.X resources/views/hello/world.blade.php Another example @include(‘some.directory.structure.foo’); would display the following view // for Laravel … Read more

Laravel 5 – global Blade view variable available in all templates

Option 1: You can use view::share() like so: <?php namespace App\Http\Controllers; use View; //You can create a BaseController: class BaseController extends Controller { public $variable1 = “I am Data”; public function __construct() { $variable2 = “I am Data 2”; View::share ( ‘variable1’, $this->variable1 ); View::share ( ‘variable2’, $variable2 ); View::share ( ‘variable3’, ‘I am Data … Read more