How do I send a bank query to a View in Laravel? [closed]

0

I have a model (table) called Member. I want to do the id count that exists in the bank. Well I did with Member :: Count ('id'). It returns me everything nice and the total id I have on the table. More when I play the view it gives an error: Speaking I'm trying to get property and not object Trying to get property of non-object How do I make an appointment and send it to the View?

Error:

Controller
 public function create()
{

    $membro = new Membro();
    $ficha = $membro->countID();
    $data = array(
        'titulo'        =>  'Lista de membros',
        'localizador'   =>  'Listagem de membro',
        'info'          =>  'Listas de Membros',
        'avatar'        =>  Auth()->user(), 
        'ficha'         =>  $ficha,       

    );



    return view('dashboard.cadastroMembros.create', $data);
    
asked by anonymous 06.08.2017 / 04:08

1 answer

1

Try to do:

return view('dashboard.cadastroMembros.create', compact('data'));

And when you print in the view something like {{$ data ['title']}}

    
07.08.2017 / 05:21