-1

i need to create one variable of text in LARAVEL

if((strlen($tpesquisa ))<4) {
    return view('pesquisa');
    ///////// for example msgm= 'it is necessary to use more than 4 words to start searching';
}

/////////////// for example msgm= 'were found x results';

return view('pesquisa',compact('produtos'));

and in view print the msgm <p>{{$msgm}}</p> how create the variable with value text? and how can I measure the results?

Klaus Gütter
  • 11,151
  • 6
  • 31
  • 36
Mica G
  • 19
  • 7

1 Answers1

0

You can just define

$msgm = 'whatever the text'

And then, in the return view you can do:

return view('pesquisa',compact('produtos', 'msgm'));

Cornel Raiu
  • 2,758
  • 3
  • 22
  • 31