0

list.blade.php

<?php
$categories=[
'1'=>'cat1',
'2'=>'cat2',
'3'=>'cat3',
    ];
?>

index.blade.php

@extends('layouts.app')

@section('content')

@include('partials.list')


<?php 
  foreach($categories as $key => $value) 
  { 
     echo "$value <br />"; 
  } 
?>  

@endsection

How to use $categories in index.blade.php? Why @include('partials.list') is not working? Thanks!

Yrtymd
  • 433
  • 2
  • 5
  • 16
  • http://stackoverflow.com/questions/29715813/laravel-5-global-blade-view-variable-available-in-all-templates – joaumg Dec 09 '16 at 13:33
  • So, are you not able to include the "partials/list.blade.php" into "index.blade.php" OR yu are just not able to get that $categories vaiable into "index.blade.php"? – Parth Vora Dec 10 '16 at 08:32

0 Answers0