Laravel call variavel

Asked

Viewed 200 times

2

I am new in the Lockable and I’m trying to call the variable as I saw in the video class but still giving 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 I call

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

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

@section('foot')
    footer
@endsection

error inserir a descrição da imagem aqui

  • what mistake?...

  • 1

    of the indefinite variable

1 answer

4


In fact its variable is not called $teste1 in your View. You are passing it as teste. That means you have to retrieve it as $teste.

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

Just exchange {{$teste1}} for {{$teste}} in your View.

  • 2

    our brother vlw was here

Browser other questions tagged

You are not signed in. Login or sign up in order to post.