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!