Getting a bunch of undefined variable errors on Windows - same site builds just fine on Mac - for my variables that are set up in my app\View\Composers. Using Sage/Bud/Acorn.
Including code here:
Composer file: TemplatePrivateSchool.php
<?php
namespace App\View\Composers;
use Illuminate\Support\Collection;
use Roots\Acorn\View\Composer;
use function Roots\asset;
class TemplatePrivateSchool extends Composer
{
/**
* List of views served by this composer.
*
* @var array
*/
protected static $views = [
'templates/private-school',
];
/**
* Data to be passed to view before rendering.
*
* @return array
*/
public function with()
{
return [
'purposeOf' => $this->getPurposeOfData(),
'wellRegarded' => $this->getWellRegardedData(),
'educationalServices' => $this->getEducationalServicesData(),
'admissions' => $this->getAdmissionsData(),
'academicProgramsOffer' => $this->getAcademicProgramsOfferData(),
];
}
/**
* Data to be passed to view before rendering, but after merging.
*
* @return array
*/
public function override()
{
return [
'heroBackgroundColor' => '#fff',
];
}
/**
* Returns "" data.
*
* @return array
*/
public function getPurposeOfData()
{
return [
'content' => 'Lorem ipsum',
];
}
/**
* Returns "" data.
*
* @return array
*/
public function getWellRegardedData()
{
return [
'content' => 'Lorem ipsum',
];
}
/**
* Returns "" data.
*
* @return array
*/
public function getEducationalServicesData()
{
return [
'heading' => 'Lorem ipsum',
'content' => 'Lorem ipsum',
];
}
/**
* Returns "" data.
*
* @return array
*/
public function getAdmissionsData()
{
return [
'heading' => 'Lorem ipsum',
'content' => 'Lorem ipsum',
'image' => [
'url' => asset(''),
'alt' => '',
'title' => '',
],
];
}
/**
* Returns "" data.
*
* @return array
*/
public function getAcademicProgramsOfferData()
{
return [
'heading' => 'Lorem ipsum',
'list' => [
'Lorem ipsum',
],
];
}
/**
* Returns "" data.
*
* @return array
*/
// public function getData()
// {
// return [
// 'heading' => '',
// 'subheading' => '',
// ];
// }
}
Blade file: private-school.blade.php
{{-- Purpose Of --}}
@if($purposeOf)
<div class="relative flex flex-col w-full p-6 text-white rounded-lg bg-blue md:p-12 md:pr-20" data-aos="fade-right">
{{-- <span class="mx-auto">block</span> --}}
<div class="prose-lg">{!! $purposeOf['content'] !!}</div>
</div>
@endif
File structure:
Any ideas why it might not be creating these variables on Windows?