title: Unable to use Laravel Eloquent findOrFail method using call_user_func_array function
body: <p>I have searched how to use <strong>call_user_func_arra</strong>y with Eloquent method. But didn't find any clue about it.
  I want to make my code more flexible using call_user_func_array method in my Eloquent query.</p>
  
  <p><strong>Code not working:-</strong></p>
  
  <pre><code>$object = call_user_func_array($this-&gt;object_type . '::findOrFail', [$this-&gt;object_slug]);
  </code></pre>
  
  <p><strong>Error:-</strong></p>
  
  <p><em>ErrorException (E_UNKNOWN) 
  call_user_func_array() expects parameter 1 to be a valid callback, class 'Friendship' not found.</em></p>
  
  <p>But if I am not using call_user_func_array method, then my below code is running fine:-</p>
  
  <pre><code>$object = Friendship::find($this-&gt;object_slug);
  </code></pre>
  
  <p>Please guide me whether static callback method  be used in call_user_func_array function? If not then please suggest any alternate approach.</p>
  
  <hr>
  
  <p><strong>Problem Solved:-</strong></p>
  
  <p><strong>call_user_func_array</strong> method don't care about <code>use namespaces</code>. So in case of namespaces add full path of class.</p>
  
  <p><strong>Updated code:-</strong></p>
  
  <p><code>call_user_func_array('\SiteApp\Friendship\\' . $this-&gt;object_type . '::findOrFail', [$this-&gt;object_slug]);</code></p>
  
  <p>Thanks for help :)</p>