0

My page.blade.php has several sections and I am using laravel variable $companies which works fine in the content section but not in the js scripts section. What is wrong?

@extends ('layout.master')

@section ('styles')
   ...
@endsection

@section ('content')
@foreach ($companies as $company)
  using {{ $company->company }} works fine here
@endforeach

@section ('scripts')
<script>
  ...
@foreach ($companies as $company) returns error "Undefined variable: companies (View: /Users/paul/WebSites/FairTrade/resources/views/page.blade.php)"
  using {{ $company->company }} 
@endforeach
  ...
</script>

Thank you for helping...

3

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.