Undefined variable in component
P粉709307865
P粉709307865 2023-09-06 10:48:25
0
1
719

My server works in Linux via apache2, but works fine in development environment via artisan service on a Windows machine.

The error isUndefined variable $washProgram

  • resources/views/components/expedition-data.blade.php
Programa {{ $washProgram->name }}
  • app/View/Components/expeditionData.php
op = $op; $this->washProgram = $op->getSelectedWashProgram(); } /** * Get the view / contents that represent the component. * * @return \Illuminate\View\View|string */ public function render() { return view('components.expedition-data'); } }
  • Calling components in Blade

I want to generate a view using this component but it gives me this error.

P粉709307865
P粉709307865

reply all (1)
P粉384366923

Thank you so much. Linux is case sensitive. The component's file names have been changed so that they all begin with a capital letter:

expeditionData.php -> ExpeditionData.php
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!