I am logged in as the first student in the table. I want to retrieve a list of all the students who are within the same department as mine and whom I didn't send a request to yet, using Eloquent model.
//Requestt.php
public function student()
{
return $this->belongsto('App\Student','id', 'Sender_id','Rec_id');
}
//Student.php
public function requestts()
{
return $this->hasMany('App\Requestt', 'id');
}
public function department()
{
return $this->belongsTo('App\Department');
}
Note: Don't mind the double "t" in requestt.