2017-06-02 4 views
1

konnte ich nicht finden Ich habe versucht, einen Benutzer mit einem Profil zu verbinden. Hier ist mein Code:Laravel CRUD ORM Modell

Profil Modell:

class Profile extends Model 
{ 
    public function user(){ 
     return $this->belongsTo('App\User'); 
    } 
} 

Benutzermodell:

class User extends Authenticatable 

{ 
    ... 
    public function profile(){ 
     return $this->hasOne('App/Profile'); 
    } 
} 

Profile:

public function show($username) 
    { 
     $user = User::where('username',$username)->first(); 
     $profile = $user->profile; 
     return view('profiles.show')->withProfile($profile); 
    } 

Strecke (Es soll "profil" sein):

Route::resource('profil','ProfileController'); 

Fehler: http://prntscr.com/ff6y0a

Irgendwelche Tipps auf den Rest der CRUD-Funktionalität zu tun ist sehr willkommen!

Antwort

1

Ändern Sie App/Profile zu App\Profile in Ihrer User Modellbeziehung.