mardi 10 avril 2018

Call a function from view Laravel 5

I am working on a Laravel Project and I need some help

I am passing data from AdsController.php

$ads = Ads::all(); 
return view('Ads/index', enter code herecompact('ads','users'));

But in the Same view I want to get data from other tables

@foreach ($ads as $ad) 
$ad->id // Now from this Id I want to get the user's name and picture so..

@endforeach

in The AdsController I have the function

Public static function get_user_img($id){
$user = User::find($id);
return $user-img;
}

But I keep getting this error Class 'AdsController' not Found !



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire