Why my one to one relation method doesnt work ?
here my controller
use App\User;
public function delete ($id){
$student = \App\Student::find($id);
$student->user()->delete();
return redirect('/student')->with('sukses');
}`
Here my user model
public function user(){
return $this->hasOne(Student::class);
}
Student model
public function Student(){
return $this->belongsTo(User::class);
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire