0
votes

I got stuck with one to one relation Error View Facade\Ignition\Exceptions\ViewException Class 'App\App\User' not found (View: /var/www/html/project1/resources/views/pengajuan/datauser/index.blade.php) http://app.web/pengajuan/datauser

my User Model

public function dataUser()
{
  return $this->hasOne(App\DataUser::class);
}

my DataUser Model

public function User()
{
    return $this->belongsTo(App\User::class);
}

my controller

public function index()
{
    $datauser = DataUser::all();
    return view('pengajuan.datauser.index', compact('datauser'));
}

and my index view

@foreach ($datauser as $d)
 <td>{{$d->masa_penilaian}}</td>
 <td>{{$d->user->nama}}</td>
 <td>{{$d->nip}}</td>
 <td>{{$d->nuptk}}</td>
@endforeach

Can Help Me?

Thanks

1
could you try DataUser::class instead of App\DataUser::class and User::class instead of App\User::class? - Uzair Riaz
thanks @UzairRiaz, that is my problem I use doble class on model - M.Alfrandhy .D.D
I will post this as an answer so you can accept it - Uzair Riaz

1 Answers

1
votes

Try DataUser::class instead of App\DataUser::class and User::class instead of App\User::class?