title: How can i check request comes or not in laravel?
body: <p>I want to get <code>$data['student']</code> if request get (like: student-guardian?reg_no=0001 in URL).
  if no any parameter on url <code>$data['student']</code> don't needed.</p>
  
  <p>My <code>StudentGuardian</code> function Like:</p>
  
  <pre><code>public function studentGuardian(Request $request)
  {
      $data = [];
      if(!empty($request)){
          $data['student'] = Student::select('id','reg_no','reg_date', 'first_name', 'middle_name', 'last_name','faculty', 'semester','status')
              -&gt;where(function ($query) use ($request) {
  
                  if ($request-&gt;has('reg_no')) {
                      $query-&gt;where('students.reg_no', 'like', '%'.$request-&gt;reg_no.'%');
                      $this-&gt;filter_query['students.reg_no'] = $request-&gt;reg_no;
                  }
  
              })
              -&gt;get();
      }
  
      return view(('studentguardian.index'), compact('data'));
  }
  </code></pre>