I am using laravel framework 5.4 and write following controller class:
class ProfileController extends Controller
{
public function index(){
$uprofile = DB::table('user_profile')->find(Auth::id());
return view('folder.profile')->with('uprofile',$uprofile);
}
route is:
Route::get('/','ProfileController@index');
At view I'm using
@foreach($uprofile as $profile)
$profile->id
@endforeach
What seems wrong here?
in your index method , just remove $uprofile
Change your
index()
method to :Also in
view