I use laravel framework 5.4 and write the 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:
Route::get('/','ProfileController@index');
In the view, I use
@foreach($uprofile as $profile)
$profile->id
@endforeach
What is wrong here?
source
share