Heimdall
1 week ago
131
13
General

Display request eloquent

Posted 1 week ago by Heimdall

Hi

I want display my collection on my view but i have one error:

public function index()
{

    $publi = Publication::orderBy('id','DESC') ->skip(0) -> take(2) ->get();
    return view('welcome',['datass' => $publi]);
     

}

and on my view:

@foreach($datass as $publi)

{{ $publi-> nom}}

{{ $publi-> titre}}

@endforeach

and my error is:

Undefined variable: datass (View: C:\laragon\www\spa-vesoul\resources\views\welcome.blade.php)

Ty

Please sign in or create an account to participate in this conversation.