title: Laravel NeoEloquent equivalent to Inner Join
body: <p>I have this Graph </p>
  
  <p><a href="https://i.stack.imgur.com/zDVMz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zDVMz.png" alt="enter image description here"></a></p>
  
  <p>The green Nodes are Answers.</p>
  
  <p>The dark rose node is Question, there could be more than one.</p>
  
  <p>The Blue node is a section, there could be more than one.</p>
  
  <p>And finally the rose node is the questionnaire.</p>
  
  <p>And I've downloaded <a href="https://github.com/Vinelab/NeoEloquent" rel="nofollow noreferrer">NeoEloquent</a> from Vinelab, my problem is that I have to get a Questionnaire, but I'm getting nothing from there.</p>
  
  <p>My Models Are</p>
  
  <p><strong>Section</strong></p>
  
  <pre><code>use Illuminate\Database\Eloquent\Model as NeoEloquent;
  use App\Question;
  use App\Questionnaire;
  
  class Section extends \NeoEloquent
  {
      protected $label = "Section";
      /**
       * The attributes that are mass assignable.
       *
       * @var array
       */
      protected $fillable = [
        'title'
      ];
  
      public function questionnaire(){
        return $this-&gt;hasOne('App\Questionnaire','IS_IN');
      }
  }
  </code></pre>
  
  <p><strong>Question</strong></p>
  
  <pre><code>use Illuminate\Database\Eloquent\Model;
  use Illuminate\Database\Eloquent\Model as NeoEloquent;
  use App\Answer;
  use App\Section;
  
  class Question extends \NeoEloquent
  {
      protected $label = 'Question'; //Node name
      /**
       * The attributes that are mass assignable.
       *
       * @var array
       */
      protected $fillable = [
          'question','type'
      ];
      public function section(){
        return $this-&gt;hasOne('App\Section','IS_IN');
      }
  }
  </code></pre>
  
  <p><strong>Answer</strong></p>
  
  <pre><code>use Illuminate\Database\Eloquent\Model;
  use Illuminate\Database\Eloquent\Model as NeoEloquent;
  use App\Question;
  
  class Answer extends \NeoEloquent
  {
       protected $label = 'Answer';
  
      /**
       * The attributes that are mass assignable.
       *
       * @var array
       */
      protected $fillable = [
          'content'
      ];
      public function question(){
        return $this-&gt;hasOne('App\Question','IS_IN');
      }
  }
  </code></pre>
  
  <p>I've found some examples getting the parent from the child but the thing is that I have to make an API that gets Questionnaire ID and have to return all the children nodes.</p>
  
  <p><strong>I've tried something like this.</strong></p>
  
  <pre><code>$trying = Section::whereHas('questionnaire',function($query) use($id){
          $query-&gt;where('id','=',$id);
        })-&gt;get();
  </code></pre>
  
  <p>But this just brings me the parent questionnaire, but no the secction,
  another solution I've realized was to get all nodes and make and array
  by a foreach and some if. </p>
  
  <blockquote>
    <p>Cypher equivalent</p>
    
    <p><code>match (q:Questionnarie)&lt;-[x]-(y:Section)&lt;-[t]-(n:Question)&lt;-[e]-(p:Answer) where ID(q) = 83 return q,x,y,t,n,e,p</code></p>
  </blockquote>