Laravel call variable

1

I'm new to laravel and I'm trying to call the variable I saw in the video lesson but it still gives error control

    <?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class SiteController extends Controller
{
    public function index(){
        $teste1 = 1;
        $bs = 12;
        return view('site.Home.index', ['teste'=>$teste1] );
    }
}

Where do I call

 @extends('/site.Templede.templede1')
@section('title')
 teste
@endsection

@section('body')
{{$teste1}}
ss
@endsection

@section('foot')
    footer
@endsection

error

    
asked by anonymous 18.06.2018 / 17:26

1 answer

3

Actually your variable is not called $teste1 in your View. You are passing it as teste . This means that you have to retrieve it as $teste .

The line you pass the variable is this: return view('site.Home.index', ['teste'=>$teste1] ); . Here you set the variable name $teste1 to teste .

Just swap {{$teste1}} with {{$teste}} in your View.

    
18.06.2018 / 17:31